Skip to main content

opentelemetry-stdout

Version: 0.31.0 The opentelemetry-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.
Not for production use. This exporter is designed for debugging and educational purposes only. The output format is not optimized for performance and may change without notice.

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’s Debug formatting to print telemetry data. The output includes: For Traces:
  • Span name and IDs
  • Start and end times
  • Attributes
  • Events
  • Links
  • Status
For Metrics:
  • Metric name and description
  • Unit
  • Data points with values and attributes
  • Aggregation type
For Logs:
  • 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

  • Performance: Not optimized for high-throughput scenarios
  • Format stability: Output format may change between versions
  • Production use: Not recommended for production environments
  • Buffering: Uses simple synchronous I/O

Documentation

Full API Documentation

View complete API reference on docs.rs

Minimum Rust Version

MSRV: 1.75.0