tracing is the logging and instrumentation crate of the Rust async ecosystem. OpenTelemetry is the vendor-neutral protocol to ship that data somewhere useful. Together they give you traces, metrics and logs from one set of annotations.
The pipeline#
onhlt ──OTLP/gRPC──▶ OpenTelemetry Collector ──▶ Tempo (traces)
├─▶ Prometheus (metrics)
└─▶ Loki (logs)
▲
Grafana reads all three
The application only knows one endpoint, the Collector. Swapping a backend never touches Rust code.
Instrumenting handlers#
async
Each request gets a root span from tower-http’s TraceLayer. SQL queries, cache lookups and template rendering become child spans, so a slow page shows exactly where the time went.
Correlating logs and traces#
Logs are emitted as JSON with the current trace_id. In Grafana, a log line in Loki links straight to its trace in Tempo, and back.
What to measure first#
- Latency per route, at p50, p95 and p99.
- Cache hit ratio.
- Duration and outcome of each content sync.
- Remaining GitHub API quota.
Four numbers, and you know whether the site is healthy.