How tokio-rs/tracing works
Main Components
a) Core Components:
• tracing-core: The fundamental primitives layer
• tracing: The main instrumentation API
• tracing-subscriber: The collector implementation layer
b) Integration Components:
• tracing-futures: Async/futures integration
• tracing-attributes: Procedural macros
• tracing-log: Log compatibility layer
• tracing-appender: Output handling
• tracing-error: Error instrumentation
• tracing-flame: Flame graph generation
┌─────────────────────────────────────────────────────────────────┐
• Application Layer │
• ┬─────────────────────────────────┘
┌───────────────────────────────▼─────────────────────────────────┐
• Instrumentation Layer │
• ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
• tracing │◄──►│ tracing-attr │◄──►│ tracing-futures │ │
• ┬──────┘ └──────────────┘ └──────────────────┘ │
• ┌──────▼──────┐ │
• tracing-core │ │
• ┬──────┘ │
• ┼──────────────────────────────────────────────────────┘
┌─────────▼──────────────────────────────────────────────────────┐
• Collector Layer │
• ┌─────────────────┐ ┌──────────────┐ ┌───────────────┐ │
• tracing-subscriber│──►│tracing-appender│ │tracing-flame │ │
• ┘ └──────────────┘ └───────────────┘ │
• ┘
┌─────────▼──────────────────────────────────────────────────────┐
• Output Targets │
• ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌──────────────────┐ │
• Files │ │ Stdout │ │ Journald │ │ Flame Graphs │ │
• ┘ └─────────┘ └──────────┘ └──────────────────┘ │
• ┘
Important Relationships to Highlight
• How tracing-core provides the foundation for all other components
• How tracing-subscriber acts as a bridge between instrumentation and output
• Demonstrate how different output formats are handled through the collector layer
Additional Elements
• Version compatibility information
• Integration points with external systems (log crate, async runtimes)
Implementation Details
• Use standardized UML notation where appropriate