ro11y: Lightweight Observability
Context
ro11y is a Rust observability library that implements OTLP protobuf export over HTTP without pulling in the full OpenTelemetry SDK. Seven direct dependencies instead of a hundred and twenty. It builds on the tracing crate for structured logging and distributed tracing.
Why Not the OpenTelemetry SDK
The official Rust SDK requires version lock-step across multiple opentelemetry-* crates, pulls in ~120 transitive dependencies (3+ minute compile times), and has a shutdown footgun where drop() doesn't flush pending spans. The gRPC transport via tonic/prost adds further bloat for services that only need HTTP export.
ro11y hand-rolls the protobuf encoding in ~200 lines of Rust, leveraging the fact that the protobuf wire format hasn't changed since 2008. The result is a library that compiles fast, exports standard OTLP, and never blocks your service.
Architecture
The core is a tracing::Layer that captures spans and events, encodes them as OTLP protobuf (ExportTraceServiceRequest, ExportLogsServiceRequest), and ships them over HTTP POST to any OTLP-compatible collector, including Vector, Grafana Alloy, and the OpenTelemetry Collector.
Dual output mode supports OTLP HTTP for production and JSON stderr for local development or CloudWatch fallback. A background exporter with 3-retry exponential backoff ensures telemetry never blocks service operations.
Signals
- Traces: Standard OTLP trace export with W3C traceparent propagation
- Logs: OTLP log export from tracing events
- Metrics: RED metrics (rate, errors, duration) emitted as structured log events, designed for Vector's
log_to_metrictransform - Process metrics: CPU and memory via
/procpolling on Linux
Optional Tower middleware integrates with Axum for automatic request instrumentation, CloudFront request ID extraction, and BLAKE3-based deterministic trace IDs.
Links
- Source: github.com/l1x/ro11y
- License: MIT / Apache-2.0