Skip to main content
The stdout exporter writes telemetry data to standard output, making it ideal for development, debugging, and learning. It supports all three OpenTelemetry signals: traces, metrics, and logs.
The stdout exporter is designed for development and debugging only. It is not optimized for production use, and the output format may change between versions.

Installation

Add the dependency to your Cargo.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

The stdout exporter writes synchronously and can block your application. It is not suitable for production use.

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:

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

  1. Ensure shutdown is called:
  2. Check feature flags:
  3. Verify exporter is set:

Output Mixed with Application Logs

Redirect stderr separately:
Or use a custom writer:

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