opentelemetry-stdout
Version: 0.31.0 Theopentelemetry-stdout crate provides exporters that print telemetry data (traces, metrics, and logs) to standard output. This is primarily intended for debugging, learning, and development purposes.
Installation
Feature Flags
trace: Include trace span exporter (enabled by default)metrics: Include metrics exporter (enabled by default)logs: Include log exporter (enabled by default)
Quick Start
Trace Export
Metrics Export
Logs Export
Exporters
SpanExporter
struct
Prints trace spans to stdout with human-readable formatting
MetricExporter
struct
Prints aggregated metrics to stdout
LogExporter
struct
Prints log records to stdout
Complete Example
Output Format
The exporters use Rust’sDebug formatting to print telemetry data. The output includes:
For Traces:
- Span name and IDs
- Start and end times
- Attributes
- Events
- Links
- Status
- Metric name and description
- Unit
- Data points with values and attributes
- Aggregation type
- Timestamp
- Severity level
- Body/message
- Attributes
- Trace context (if available)
Use Cases
Learning
Understand how OpenTelemetry structures telemetry data
Debugging
Verify instrumentation is working correctly
Testing
Validate telemetry in unit and integration tests
Development
Quick local debugging without backend setup
Limitations
Related Crates
- opentelemetry - Core API
- opentelemetry-sdk - SDK implementation
- opentelemetry-otlp - Production-ready OTLP exporter
Documentation
Full API Documentation
View complete API reference on docs.rs