cgn-telemetry 0.1.1

Cognitora: tracing, OTLP, and Prometheus wiring shared by every binary
Documentation

cgn-telemetry

crates.io docs.rs license

Tracing, OTLP export, and Prometheus exposition shared by every Cognitora binary.

init wires a tracing-subscriber with EnvFilter (driven by RUST_LOG), optionally enables OTLP-over-tonic export when an endpoint is configured, and registers a process-wide Prometheus registry. The admin_router returns an axum Router that serves /metrics, /healthz, and /readyz for use by the orchestrator and load balancers.

Use

[dependencies]
cgn-telemetry = "0.1"
use cgn_telemetry::{init, admin_router, registry};
use prometheus::IntCounter;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    init("cgn-router")?;
    let counter = IntCounter::new("requests_total", "incoming requests")?;
    registry().register(Box::new(counter.clone()))?;

    let admin = admin_router();
    // ... serve admin on :9091, traffic on :8080 ...
    Ok(())
}

License

Apache-2.0. See LICENSE.

Part of Cognitora.