What problem does it solve?
This Skill prevents misleading, interleaved, or incorrect tracing output in Axum by guiding you to install a tracing-subscriber correctly and emit structured spans and events safely in async code.
Core Features & Use Cases
- Safe subscriber initialization: install the global subscriber exactly once in main using EnvFilter and fmt layers.
- Deterministic request tracing middleware: instrument every HTTP request with tower-http TraceLayer::new_for_http and its span naming via MatchedPath.
- Async-safe span creation and logging: use #[tracing::instrument] or Future::instrument instead of holding Span::enter guards across await, and emit key/value fields (with %/? sigils) rather than interpolated messages.
- Optional distributed tracing export: compose tracing-opentelemetry onto the same registry for OpenTelemetry backends (OTLP).
- Use cases: debugging “no logs appear,” startup panics from double init, incorrect span nesting/parenting, broken span cardinality caused by using the raw URI, and exporting traces to Jaeger/Tempo/Grafana.
Quick Start
Configure your Axum app by wiring tracing-subscriber in main, add TraceLayer::new_for_http to your router, and instrument handlers with #[tracing::instrument] while emitting structured tracing::info!/error! fields.