tracing
Structured, contextual logging and distributed tracing framework for Rust. Instruments async code with spans (logical units of work) and events (log messages with metadata). Works with multiple subscribers/collectors — tracing-subscriber for local logging, opentelemetry-rust for distributed tracing. The standard observability approach for async Rust services (Axum, Tokio use it internally).
Score Breakdown
⚙ Agent Friendliness
🔒 Security
MIT licensed. Avoid tracing sensitive data — span fields are visible in logs. Use skip() in #[instrument] for sensitive parameters.
⚡ Reliability
Best When
You're building async Rust services (especially with Tokio/Axum) and need structured logging that preserves context through async .await boundaries.
Avoid When
Simple synchronous Rust programs — the log crate is simpler. Tracing's value compounds with async complexity.
Use Cases
- • Add structured logging to Rust agent services with span-based context propagation through async call chains
- • Instrument async Rust agent code where traditional logging loses context across .await points
- • Integrate with OpenTelemetry for distributed tracing across Rust agent microservices
- • Add #[tracing::instrument] to agent functions to automatically trace function entry, exit, and parameters
- • Correlate logs with request IDs across async Rust agent service handlers using span context
Not For
- • Simple synchronous Rust programs — standard log crate is simpler for non-async code
- • Non-Rust environments — use OpenTelemetry SDKs for other languages
- • Zero-dependency projects — tracing adds compile time with proc-macro dependencies
Interface
Authentication
Local library — no authentication required. MIT licensed.
Pricing
MIT licensed. Zero cost.
Agent Metadata
Known Gotchas
- ⚠ tracing is the instrumentation API; tracing-subscriber is the output backend — must add both as dependencies; tracing alone produces no output without a subscriber
- ⚠ #[tracing::instrument] on async functions traces function entry/exit — use skip() for large/sensitive args: #[tracing::instrument(skip(password, db))]
- ⚠ Span context propagates through async code automatically — but NOT across thread boundaries via std::thread::spawn; use tokio::spawn which preserves span context
- ⚠ tracing::info_span!() creates a span but you must .enter() it or use span.in_scope(|| {}) — forgotten enter() means no span context
- ⚠ Log interop: tracing-log bridges the log crate to tracing — add tracing_log::LogTracer::init() to capture third-party library logs in tracing subscriber
- ⚠ OpenTelemetry integration: opentelemetry-otlp + tracing-opentelemetry — multiple crate versions must be compatible; pin exact versions in Cargo.lock
Alternatives
Full Evaluation Report
Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for tracing.
AI-powered analysis · PDF + markdown · Delivered within 30 minutes
Package Brief
Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.
Delivered within 10 minutes
Score Monitoring
Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.
Continuous monitoring
Scores are editorial opinions as of 2026-03-07.