| Crates.io | o11y |
| lib.rs | o11y |
| version | 0.0.1 |
| created_at | 2025-10-27 00:05:12.457913+00 |
| updated_at | 2025-10-28 23:06:02.313713+00 |
| description | Observability library for Rust: logging, metrics, tracing, and profiling. |
| homepage | https://github.com/mfahmialkautsar/rust-o11y |
| repository | https://github.com/mfahmialkautsar/rust-o11y |
| max_upload_size | |
| id | 1902039 |
| size | 184,854 |
Observability building blocks for Rust services: unified configuration for logging, tracing, metrics, and continuous profiling on top of OpenTelemetry.
Telemetry::new wires logger, tracer, meter, and profiler from one config.cargo add o11y --features="logger tracer meter profiler"
The crate targets Rust 1.85 or newer (2024 edition). Tokio is required when using async components:
[dependencies]
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
use o11y::{Config, Telemetry};
use o11y::logger::LoggerConfig;
use o11y::meter::{MeterConfig, RuntimeConfig};
use o11y::tracer::TracerConfig;
fn main() -> anyhow::Result<()> {
let config = Config::new("billing-service")
.with_logger(
LoggerConfig::new("billing-service")
.with_endpoint("http://localhost:3100/otlp"),
)
.with_tracer(
TracerConfig::new("billing-service")
.with_endpoint("http://localhost:4317")
.use_global(true),
)
.with_meter(
MeterConfig::new("billing-service")
.with_endpoint("http://localhost:9009/otlp")
.with_runtime(RuntimeConfig::default())
.use_global(true),
);
let telemetry = Telemetry::new(config)?;
// Emit logs, traces, and metrics using OpenTelemetry APIs here.
telemetry.shutdown();
Ok(())
}
See tests/telemetry_all_in_one.rs for an end-to-end example that exercises logs, traces, and metrics against Grafana backends.
| 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) |
[dependencies]
o11y = { version = "0.0.1", default-features = false, features = ["logger", "tracer"] }
ResourceConfig controls service metadata (name, version, namespace, environment).LoggerConfig, TracerConfig, MeterConfig, ProfilerConfig) expose builder-style APIs for endpoints, auth, timeouts, sampling, and runtime behavior.o11y::auth::Credentials.use_global(true) to apply providers to OpenTelemetry globals.Refer to module-level docs on docs.rs for the complete API surface.
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
Integration scenarios mirror README samples:
cargo test --test telemetry_all_in_one
cargo test --test telemetry_standalone
This project is licensed under the GNU GPLv3 only.