Expand description
§Sideways OTel 🦀
Observability from the side - because crabs walk sideways, and so should your telemetry.
A production-ready telemetry library for Rust services that provides vendor-neutral OpenTelemetry tracing, metrics, and logs, exported via OTLP to any compatible backend (a local Collector, Honeycomb, or anything else that speaks OTLP).
§Features
- Easy one-line initialization for traces, metrics, and logs
- Graceful degradation when the OTLP endpoint is unavailable
- Environment-based configuration using standard
OTEL_*variables - Health check filtering to reduce noise
- Native OpenTelemetry metrics API - no vendor-specific macros required
- W3C Trace Context + Baggage propagation installed by default, matching
the
OTEL_PROPAGATORSspec default
§Quick Start
use sideways_otel::prelude::*;
use sideways_otel::{init_telemetry, TelemetryConfig};
fn main() {
let config = TelemetryConfig::from_env();
let telemetry = init_telemetry(&config);
tracing::info!("Application started");
let requests = counter("requests.handled");
requests.add(1, &[KeyValue::new("status", "success")]);
telemetry.shutdown();
}Modules§
- metrics
- prelude
- propagation
- resource
- span
- Helpers for enriching the current
tracingspan with OpenTelemetry attributes and events, without needing to reach fortracing_opentelemetrydirectly. - tracing
Macros§
- build_
otlp_ exporter - Build an OTLP exporter for a given signal (traces/metrics/logs), honoring
crate::OtlpProtocol: gRPC (via tonic, with header/TLS support) or HTTP/protobuf (via reqwest, with plain string headers).$builder_ctoris an expression likeopentelemetry_otlp::SpanExporter::builder().
Structs§
- Telemetry
- Telemetry components that need to be kept alive for the duration of the application and flushed/shutdown on exit.
- Telemetry
Config - Configuration for telemetry initialization.
- Telemetry
Config Builder - Builder for
TelemetryConfig.
Enums§
- Otlp
Protocol - Which OTLP wire protocol to export over.
- Propagator
Kind - A
W3C-standard context propagation format. Corresponds to the values accepted by the standardOTEL_PROPAGATORSenvironment variable, though onlytracecontextandbaggageare currently supported here - the spec also definesb3,b3multi,jaeger,xray, andottrace, each of which needs its own crate (opentelemetry-zipkin, etc.). Add support for those as real use cases show up rather than pre-building the full matrix. - Telemetry
Error
Functions§
- init_
telemetry - Initialize telemetry and install the resulting layer as the global
tracingsubscriber. A convenience wrapper aroundinit_telemetry_layerfor the common case where the application doesn’t need to add anytracinglayers of its own - if it does, callinit_telemetry_layerdirectly instead. - init_
telemetry_ layer - Initialize telemetry with the given configuration, without installing a
global
tracingsubscriber.