How open-telemetry/opentelemetry-rust works
OpenTelemetry Rust is a multi-crate observability implementation: applications instrument code through shared APIs, SDKs collect and process logs, metrics, and traces, and exporters deliver telemetry to backends or stdout. The API also provides context, baggage, and propagation; logging appenders bridge existing logging frameworks. The README documents the major exporter and signal capabilities, but most implementation files were not sampled, so edges between internal stages are limited to relationships it explicitly describes.
Main entry points: lib.rs OTLP Exporter · pipeline.rs Metrics SDK · logger.rs Logs SDK · exporter.rs Stdout Exporters
Components 28
Instrumentation APIs
- Shared API
opentelemetry/src/common.rs - Context and Baggage
opentelemetry/src/context.rs - Tracing API
opentelemetry/src/trace/context.rs - Metrics API
opentelemetry/src/metrics/instruments/counter.rs - Propagation API
opentelemetry/src/propagation/text_map_propagator.rs
Telemetry SDK
- Logs SDK
opentelemetry-sdk/src/logs/logger.rs - Metrics SDK
opentelemetry-sdk/src/metrics/pipeline.rs - Traces SDK
opentelemetry-sdk/src/trace/span_processor.rs - SDK Propagators
opentelemetry-sdk/src/propagation/trace_context.rs - Resource Metadata
opentelemetry-sdk/src/resource/mod.rs
Exporters
- OTLP Exporter
opentelemetry-otlp/src/lib.rs - OTLP Logs
opentelemetry-otlp/src/logs.rs - OTLP Metrics
opentelemetry-otlp/src/metric.rs - OTLP Traces
opentelemetry-otlp/src/span.rs - Retry Policy
opentelemetry-otlp/src/retry.rs - Prometheus Exporter
opentelemetry-prometheus/src/lib.rs - Stdout Exporters
opentelemetry-stdout/src/logs/exporter.rs - HTTP Utilities
opentelemetry-http/src/lib.rs
Logging Bridges
- Log Appender
opentelemetry-appender-log/src/lib.rs - Tracing Appender
opentelemetry-appender-tracing/src/layer.rs
Conventions
- Attribute Conventions
opentelemetry-semantic-conventions/src/attribute.rs - Metric Conventions
opentelemetry-semantic-conventions/src/metric.rs - Trace Conventions
opentelemetry-semantic-conventions/src/trace.rs
Other components
- Application
- Logging Frameworks
- Telemetry Backends
- Console Output
- Prometheus
Connections 31
- Application → Shared API: instruments with
README.md - Application → Context and Baggage: carries context
README.md - Application → Tracing API: creates spans
README.md - Application → Metrics API: records measures
README.md - Shared API → Logs SDK: uses SDK
- Tracing API → Traces SDK: uses SDK
- Metrics API → Metrics SDK: aggregates measures
README.md - Context and Baggage → Propagation API: shares context
- Propagation API → SDK Propagators: implements propagation
- Metrics SDK → Prometheus Exporter: exports metrics
README.md - Prometheus Exporter → Prometheus: serves metrics
README.md - Logs SDK → OTLP Exporter: exports logs
README.md - Metrics SDK → OTLP Exporter: exports metrics
README.md - Traces SDK → OTLP Exporter: exports traces
README.md - OTLP Exporter → OTLP Logs: supports logs
README.md - OTLP Exporter → OTLP Metrics: supports metrics
README.md - OTLP Exporter → OTLP Traces: supports traces
README.md - OTLP Exporter → Telemetry Backends: sends OTLP
README.md - OTLP Exporter → Retry Policy: retries failures
opentelemetry-otlp/src/lib.rs - Logs SDK → Stdout Exporters: exports logs
README.md - Metrics SDK → Stdout Exporters: exports metrics
README.md - Traces SDK → Stdout Exporters: exports traces
README.md - Stdout Exporters → Console Output: writes telemetry
README.md - Logging Frameworks → Log Appender: bridges log events
README.md - Logging Frameworks → Tracing Appender: bridges log events
README.md - Log Appender → Logs SDK: routes logs
README.md - Tracing Appender → Logs SDK: routes logs
README.md - Metrics SDK → Resource Metadata: attaches metadata
- Application → Attribute Conventions: uses conventions
- Application → Metric Conventions: uses conventions
- Application → Trace Conventions: uses conventions