Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Telemetry in Rust

This site is an independent how-to guide for application telemetry in Rust. It is not the official OpenTelemetry documentation. You can find the official Rust documentation at https://opentelemetry.io/docs/languages/rust/ and the crate reference at https://docs.rs/opentelemetry.

The guide is for developers and coding agents who want to add traces, metrics and logs to a Rust program, ship them with OTLP exporters, tune the SDK for performance, and store spans in SQLite or Turso. Every page states what the code does and why.

Start here

  • Setup and first signal — install the SDK, register a tracer, and see your first span.
  • Agent quickstart — a short path for coding agents to wire up telemetry with few steps.
  • Traces — create spans, add attributes, and nest work.
  • Metrics — record counters, histograms and gauges with the meter API.
  • Logs — bridge the tracing crate into OpenTelemetry logs.
  • Exporters — send telemetry with the OTLP exporter over gRPC or HTTP.
  • Configuration — read settings from environment variables instead of code.
  • Performance — benchmark the SDK and keep overhead low.
  • Spans in SQLite — store finished spans in a local SQLite file.
  • Spans in Turso — store spans in a remote Turso database.

Versions

The code in this guide was tested against these versions.

CrateVersion
opentelemetry0.33.1
opentelemetry_sdk0.33.1
opentelemetry-otlp0.33.1
opentelemetry-stdout0.33.1
opentelemetry-appender-tracing0.33.1
tracing-opentelemetry0.34.0
tracing0.1.44
tracing-subscriber0.3.23
tokio1.54.1
rusqlite0.42.0
libsql0.10.0

How the examples are checked

Every example in this guide is a complete crate in the examples folder. Each one has its own Cargo.toml and compiles on its own. The code shown on each page is included from the file that was compiled, so what you read is what runs.