Installation
Add the dependency to yourCargo.toml:
Feature Flags
The stdout exporter supports selective signal features:Quick Start
Traces
Metrics
Logs
Complete Example (All Signals)
Here’s a comprehensive example that demonstrates all three signals:Output Format
The stdout exporter prints telemetry in a human-readable JSON-like format:Trace Output Example
Metric Output Example
Log Output Example
Configuration
Custom Writer
By default, output goes to stdout. You can customize the destination:Resource Configuration
Add resource attributes that appear in all telemetry:Use Cases
Local Development
Quickly verify instrumentation without setting up a backend:Testing
Validate telemetry data in tests:Learning and Education
Understand the structure of OpenTelemetry data:Debugging Production Issues Locally
Reproduce issues with realistic data:Performance Considerations
Impact on Application Performance
- Each telemetry item is written immediately
- I/O operations block the calling thread
- Large volumes of telemetry can slow down your application
- No batching or buffering
Alternatives for Production
For production, use:- OTLP Exporter - Production-ready, supports batching
- Zipkin Exporter - For Zipkin backends
Integration with Other Tools
Piping to jq
Format output with jq for better readability:Filtering Output
Filter specific telemetry:Saving to File
Capture output for later analysis:Troubleshooting
No Output Appearing
-
Ensure shutdown is called:
-
Check feature flags:
-
Verify exporter is set:
Output Mixed with Application Logs
Redirect stderr separately:Performance Degradation
The stdout exporter is not optimized for high-volume telemetry. For production:Comparison with Other Exporters
Next Steps
OTLP Exporter
Production-ready exporter for all signals
Tracing Guide
Learn how to instrument your application