SpectraImplemented

Typed metrics and event logs

Typed counters, gauges, histograms and event logs, from one process to a cluster.
Chart an event over time and break it down by any field.

Why it exists

Define spectra_schema! and spectra_metric! for typed metrics and classified events. Each schema names a store, and each store can sit on its own backend: memory, SQLite, ClickHouse, or TensorBase (an optional columnar database).

On this site and in both templates

Spectra is mounted on this site and in both templates, and uf-spectra is published on crates.io.
Typed telemetry schemas
Implemented
Declare metric and event contracts with spectra_metric! and spectra_schema!.
Controlled emission
Implemented
Record typed counters, gauges, and events with level gates, sampling, and fail-closed controls.
Storage adapters
Implemented
Persist metrics and events to memory, SQLite, ClickHouse, or TensorBase adapters.
Per-store routing
Implemented
Send each store to its own backend, so debug logs and billing metrics don't share a database.
Query APIs
Implemented
Page through metric and event data with bounded query limits.
Aggregate event queries
Partially Implemented
Count, sum, group and pivot events for charts on memory and SQLite. ClickHouse and TensorBase return empty aggregates for now.
Spectra operator UI
Implemented
Browse schemas and explore events and metrics on this host at /spectra.

See it in action

Spectra · /spectra/schema/gauge_permission_check_log/explore

Views

Switch between the event log, time series, pie, bar and table views.
Implemented

Code sample

Taken from the getting-started docs. See all code samples on Resources.
Spectra schemaSpectra
Declarative metrics + event schemas
use spectra_macros::{spectra_metric, spectra_schema};

spectra_schema! {
    RequestDebugLog {
        store: "default",
        table: "request_debug_log",
        version: "0.1.0",
        description: "Structured debug events for request tracing",
        fields: [
            message: {
                r#type: String,
                classification: { pii: false, safe_for_console: true },
            },
        ],
    }
}

spectra_metric! {
    CacheHits {
        store: "default",
        name: "cache_hits",
        version: "0.1.0",
        description: "Counter for cache hit events",
    }
}