# tokio-rs/tracing

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/tokio-rs-tracing).**

6,750 stars · 901 forks · Rust · MIT

## Links

- GitHub: https://github.com/tokio-rs/tracing
- Homepage: https://tracing.rs
- awesome-repositories: https://awesome-repositories.com/repository/tokio-rs-tracing.md

## Topics

`diagnostics` `logging` `logging-and-metrics` `logging-facade` `logging-library` `rust` `rust-lang` `tracing`

## Description

This project is a structured tracing framework for Rust that serves as an async-aware instrumentation library and telemetry data collector. It provides a structured logging facade and the tools necessary to record, filter, and route event-based diagnostic data from both standard applications and embedded systems.

The framework distinguishes itself through a core implementation that supports bare-metal and no-standard-library environments without requiring a dynamic memory allocator. It specifically handles the complexities of asynchronous workflows by propagating diagnostic contexts across futures and tracking execution flow across await points.

Its broader capabilities include span lifecycle management to model execution hierarchy and causal relationships, as well as field-based structured metadata for machine-readable telemetry. The system incorporates a layered middleware composition for data routing and employs severity-based and compile-time filtering to minimize production overhead.

The project also provides interoperability layers to bridge structured telemetry events with traditional logging frameworks.

## Tags

### System Administration & Monitoring

- [Async Task Instrumentation](https://awesome-repositories.com/f/system-administration-monitoring/async-task-instrumentation.md) — Attaches spans to futures to maintain diagnostic context every time an asynchronous task is polled or dropped. ([source](https://tracing.rs/tracing/instrument/))
- [Instrumentation Libraries](https://awesome-repositories.com/f/system-administration-monitoring/instrumentation-libraries.md) — Provides an async-aware instrumentation library for tracking execution contexts and spans in Rust.
- [Severity Level Filtering](https://awesome-repositories.com/f/system-administration-monitoring/audit-log-filters/severity-level-filtering.md) — Controls the volume of collected data by ignoring events and spans based on their severity levels. ([source](https://tracing.rs/tracing/all.html))
- [Diagnostic Context Propagators](https://awesome-repositories.com/f/system-administration-monitoring/diagnostic-logging/diagnostic-context-propagators.md) — Implements mechanisms to maintain diagnostic context across asynchronous execution boundaries and threads.
- [Execution Context Tracking](https://awesome-repositories.com/f/system-administration-monitoring/execution-context-tracking.md) — Wraps operations in named spans to associate all internal events with a specific logical task. ([source](https://tracing.rs/tracing/all.html))
- [Application Diagnostic Data](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/observability-platforms/operational-health-alerting/health-monitoring-endpoints/application-diagnostic-data.md) — Collects stability and performance telemetry from running applications to identify bottlenecks through spans and events. ([source](https://tracing.rs/tracing/trait.collect))
- [Telemetry Routing](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/observability-platforms/operational-health-alerting/health-monitoring-endpoints/application-diagnostic-data/telemetry-routing.md) — Filters and forwards structured telemetry to different collectors based on severity or metadata. ([source](https://tracing.rs))
- [Custom Span Timing](https://awesome-repositories.com/f/system-administration-monitoring/observability-tracing/custom-span-timing.md) — Records periods of time where related events occur using specific attributes and severity levels. ([source](https://tracing.rs/tracing/macro.info_span))
- [Lifecycle Management](https://awesome-repositories.com/f/system-administration-monitoring/observability-tracing/custom-span-timing/lifecycle-management.md) — Tracks execution time and nesting by entering and exiting spans for synchronous or asynchronous scopes. ([source](https://tracing.rs/tracing/struct.span))
- [Structured Logging](https://awesome-repositories.com/f/system-administration-monitoring/structured-logging.md) — Records machine-readable diagnostic events with key-value pairs to simplify program analysis.
- [Structured Log Field Attachments](https://awesome-repositories.com/f/system-administration-monitoring/structured-logging/structured-log-field-attachments.md) — Provides capabilities for attaching persistent key-value metadata fields to structured log entries.
- [Structured Tracing Frameworks](https://awesome-repositories.com/f/system-administration-monitoring/structured-tracing-frameworks.md) — Provides a comprehensive framework for collecting structured, event-based diagnostic and telemetry data.
- [Telemetry Collectors](https://awesome-repositories.com/f/system-administration-monitoring/telemetry-collectors.md) — Records, filters, and routes diagnostic spans and events to external telemetry collectors.
- [Active Span Context Retrieval](https://awesome-repositories.com/f/system-administration-monitoring/active-span-context-retrieval.md) — Returns a handle to the currently active span or provides a fallback if the span is disabled. ([source](https://tracing.rs/tracing/struct.span))
- [Application Performance Monitoring](https://awesome-repositories.com/f/system-administration-monitoring/application-performance-monitoring.md) — Measures execution time and nesting of code blocks using spans to identify performance bottlenecks.
- [Function Auto-Instrumentation Macros](https://awesome-repositories.com/f/system-administration-monitoring/automatic-tracing-instrumentation/function-auto-instrumentation-macros.md) — Automatically enters a diagnostic span upon function entry to capture arguments and return values. ([source](https://tracing.rs/tracing/attr.instrument))
- [Compile-Time Instrumentation Filtering](https://awesome-repositories.com/f/system-administration-monitoring/compile-time-instrumentation-filtering.md) — Removes instrumentation for specific diagnostic levels from the binary to reduce production overhead. ([source](https://tracing.rs/tracing/level_filters/))
- [Dynamic Span Field Updates](https://awesome-repositories.com/f/system-administration-monitoring/dynamic-span-field-updates.md) — Assigns or updates values for predefined fields within a span to capture dynamic diagnostic information. ([source](https://tracing.rs/tracing/struct.span))
- [Logging Framework Bridges](https://awesome-repositories.com/f/system-administration-monitoring/logging-framework-bridges.md) — Translates structured events into traditional log records or consumes legacy logs as structured events for compatibility. ([source](https://tracing.rs))
- [Observability Collectors](https://awesome-repositories.com/f/system-administration-monitoring/observability-collectors.md) — Establishes a default diagnostic collector to capture events when no thread-local collector exists. ([source](https://tracing.rs/tracing/collect/fn.set_global_default))
- [Semantic Span Categorization](https://awesome-repositories.com/f/system-administration-monitoring/semantic-span-categorization.md) — Assigns names and verbosity levels to spans and events to categorize and group diagnostic data. ([source](https://tracing.rs/tracing/struct.metadata))
- [Structured Logging Frameworks](https://awesome-repositories.com/f/system-administration-monitoring/structured-logging-frameworks.md) — Serves as a facade that translates structured telemetry events into traditional log records.

### Development Tools & Productivity

- [Trace Event Emissions](https://awesome-repositories.com/f/development-tools-productivity/trace-event-emissions.md) — Records structured events at specific severity levels to capture snapshots of program state. ([source](https://tracing.rs/tracing/macro.info))

### Hardware & IoT

- [Bare Metal Diagnostic Tools](https://awesome-repositories.com/f/hardware-iot/bare-metal-diagnostic-tools.md) — Implements a tracing framework capable of running in no-std environments without a dynamic memory allocator.
- [Embedded Diagnostics](https://awesome-repositories.com/f/hardware-iot/bare-metal-logging/embedded-diagnostics.md) — Implements lightweight instrumentation for bare-metal and no-std environments where dynamic memory is unavailable.

### Operating Systems & Systems Programming

- [No-Std Environment Adapters](https://awesome-repositories.com/f/operating-systems-systems-programming/platform-development-integration/platform-support/environment-support-managers/no-std-environment-adapters.md) — Decouples the instrumentation API from the standard library to support bare-metal and embedded environments.
- [Bare Metal Development](https://awesome-repositories.com/f/operating-systems-systems-programming/systems-programming/bare-metal-development.md) — Supports instrumentation in embedded systems operating without a standard library or dynamic memory allocation. ([source](https://tracing.rs/tracing/))

### Software Engineering & Architecture

- [Asynchronous Tracing](https://awesome-repositories.com/f/software-engineering-architecture/asynchronous-tracing.md) — Tracks execution flow and diagnostic context across await points in asynchronous Rust futures.
- [Telemetry Event Dispatchers](https://awesome-repositories.com/f/software-engineering-architecture/event-subscribers/telemetry-event-dispatchers.md) — Routes instrumentation events and span lifecycles to a set of registered collectors for processing.
- [Causal Relationship Modeling](https://awesome-repositories.com/f/software-engineering-architecture/causal-relationship-modeling.md) — Links spans via associations to model indirect relationships, such as a task spawning background jobs. ([source](https://tracing.rs/tracing/struct.span))
- [Telemetry Processing Pipelines](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/layering-presentation/application-layer-architectures/middleware-layers/telemetry-processing-pipelines.md) — Employs a layered middleware composition to filter and route telemetry data in a sequential pipeline.
- [Thread-Local Context Management](https://awesome-repositories.com/f/software-engineering-architecture/thread-local-context-management.md) — Uses thread-local storage to track the current active span and maintain execution hierarchy.
- [Call-Site Filtering](https://awesome-repositories.com/f/software-engineering-architecture/zero-overhead-abstractions/zero-cost-abstraction-patterns/call-site-filtering.md) — Evaluates whether an event is enabled before executing metadata computations to minimize production overhead.

### Data & Databases

- [Span Enablement Checks](https://awesome-repositories.com/f/data-databases/data-visualization/hierarchical-performance-visualizers/execution-span-hierarchies/trace-span-storage/span-filters/span-enablement-checks.md) — Verifies if a span is active to avoid performing expensive computations when logging is disabled. ([source](https://tracing.rs/tracing/macro.span_enabled))

### DevOps & Infrastructure

- [Metadata Filters](https://awesome-repositories.com/f/devops-infrastructure/label-based-selection/target-selection-rules/selector-based-rule-filtering/metadata-filters.md) — Drops notifications for specific execution periods or events based on metadata to reduce diagnostic noise. ([source](https://tracing.rs/tracing/))

### Networking & Communication

- [Global Diagnostic Dispatchers](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-paradigms/broadcasting-patterns/global-diagnostic-dispatchers.md) — Configures a default handler for diagnostic events for a specific duration or the application lifetime. ([source](https://tracing.rs/tracing/dispatch/fn.set_default))

### User Interface & Experience

- [Collection Visibility Checks](https://awesome-repositories.com/f/user-interface-experience/page-management-systems/page-visibility-controls/event-visibility-filters/collection-visibility-checks.md) — Determines if a diagnostic event is currently being collected before executing associated logic to save resources. ([source](https://tracing.rs/tracing/macro.event_enabled))
