o11y
Observability building blocks for Rust services: unified configuration for logging, tracing, metrics, and continuous profiling on top of OpenTelemetry.
Highlights
- Unified bootstrap –
Telemetry::newwires logger, tracer, meter, and profiler from one config. - Modular features – enable only the components you need via Cargo features.
- Credential helpers – convenience constructors for basic auth, bearer tokens, API keys, and custom headers.
- Resource defaults – consistent service metadata with optional environment overrides.
- Tokio runtime metrics – optional gauges for runtime worker state when meters are global.
Installation
The crate targets Rust 1.85 or newer (2024 edition). Tokio is required when using async components:
[]
= { = "1", = ["macros", "rt-multi-thread", "time"] }
Quick Start
use ;
use LoggerConfig;
use ;
use TracerConfig;
See tests/telemetry_all_in_one.rs for an end-to-end example that exercises logs, traces, and metrics against Grafana backends.
Feature Flags
| Feature | Description |
|---|---|
logger |
OTLP logging with Loki-compatible exporters |
tracer |
Distributed tracing via OTLP/Tempo |
meter |
Metrics export with optional Tokio runtime stats |
profiler |
Pyroscope integration (Unix only) |
[]
= { = "0.0.1", = false, = ["logger", "tracer"] }
Configuration Overview
ResourceConfigcontrols service metadata (name, version, namespace, environment).- Component configs (
LoggerConfig,TracerConfig,MeterConfig,ProfilerConfig) expose builder-style APIs for endpoints, auth, timeouts, sampling, and runtime behavior. - Authentication helpers live in
o11y::auth::Credentials. - Global registration is optional per component; use
use_global(true)to apply providers to OpenTelemetry globals.
Refer to module-level docs on docs.rs for the complete API surface.
Testing
Integration scenarios mirror README samples:
License
This project is licensed under the GNU GPLv3 only.