Lines Matching full:tracing

1 ![Tracing — Structured, application-level diagnostics][splash]
3 [splash]: https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/splash.svg
5 # tracing chapter
7 Application-level tracing for Rust.
18 [crates-badge]: https://img.shields.io/crates/v/tracing.svg
19 [crates-url]: https://crates.io/crates/tracing
20 [docs-badge]: https://docs.rs/tracing/badge.svg
21 [docs-url]: https://docs.rs/tracing
23 [docs-master-url]: https://tracing-rs.netlify.com/tracing
26 [actions-badge]: https://github.com/tokio-rs/tracing/workflows/CI/badge.svg
27 [actions-url]:https://github.com/tokio-rs/tracing/actions?query=workflow%3ACI
33 `tracing` is a framework for instrumenting Rust programs to collect
39 trace the logic flow. `tracing` expands upon logging-style diagnostics by
42 in `tracing` has a beginning and end time, may be entered and exited by the
44 addition, `tracing` spans are *structured*, with the ability to record typed
47 The `tracing` crate provides the APIs necessary for instrumenting libraries
58 idiomatic `tracing`.)
63 implementation compatible with `tracing`. A `Subscriber` implements a way of
64 … as by logging it to standard output. [`tracing_subscriber`](https://docs.rs/tracing-subscriber/)'s
65 [`fmt` module](https://docs.rs/tracing-subscriber/0.3/tracing_subscriber/fmt/index.html) provides r…
66 Additionally, `tracing-subscriber` is able to consume messages emitted by `log`-instrumented librar…
71 use tracing::{info, Level};
83 tracing::subscriber::set_global_default(subscriber)
100 tracing = "0.1"
101 tracing-subscriber = "0.3.0"
110 use tracing::{info, Level};
121 tracing::subscriber::with_default(subscriber, || {
135 executable using the `tracing` crate's macros.
139 Libraries should only rely on the `tracing` crate and use the provided macros
144 use tracing::{debug, error, info, span, warn, Level};
146 // the `#[tracing::instrument]` attribute creates and enters a span
149 #[tracing::instrument]
159 // note that this is intended to demonstrate `tracing`'s features, not idiomatic
202 tracing = "0.1"
223 let _s = tracing::span!(...).entered();
232 For more details, see [the documentation on closing spans](https://tracing.rs/tracing/span/index.ht…
235 [`Future::instrument`](https://docs.rs/tracing/latest/tracing/trait.Instrument.html#method.instrume…
238 use tracing::Instrument;
245 .instrument(tracing::info_span!("my_future"))
253 [`#[instrument]`](https://docs.rs/tracing/0.1.38/tracing/attr.instrument.html)
257 use tracing::{info, instrument};
289 use tracing::{span, Level};
300 The [`#[instrument]`](https://docs.rs/tracing/0.1.38/tracing/attr.instrument.html) attribute macro
304 use tracing::{instrument};
310 tracing::info!("inside my_function!");
320 use tracing::{event, Level};
325 Users of the [`log`] crate should note that `tracing` exposes a set of macros for
328 crate. Often, the process of converting a project to use `tracing` can begin
333 Tracing is built against the latest stable release. The minimum supported
334 version is 1.42. The current Tracing version is not guaranteed to build on Rust
337 Tracing follows the same compiler support policies as the rest of the Tokio
349 In addition to `tracing` and `tracing-core`, the [`tokio-rs/tracing`] repository
350 contains several additional crates designed to be used with the `tracing` ecosystem.
357 - [`tracing-futures`] provides a compatibility layer with the `futures`
359 - [`tracing-subscriber`] provides `Subscriber` implementations and
363 - [`tracing-log`] provides a compatibility layer with the [`log`] crate,
364 allowing log messages to be recorded as `tracing` `Event`s within the
365 trace tree. This is useful when a project using `tracing` have
367 `tracing-subscriber`'s `FmtSubscriber`, you don't need to depend on
368 `tracing-log` directly.
373 - [`tracing-timing`] implements inter-event timing metrics on top of `tracing`.
375 `tracing` events and generates histograms.
376 - [`tracing-opentelemetry`] provides a subscriber for emitting traces to
377 [OpenTelemetry]-compatible distributed tracing systems.
378 - [`tracing-honeycomb`] Provides a layer that reports traces spanning multiple machines to [honeyco…
379 - [`tracing-distributed`] Provides a generic implementation of a layer that reports traces spanning…
380 - [`tracing-actix`] provides `tracing` integration for the `actix` actor
382 - [`axum-insights`] provides `tracing` integration and Application insights export for the `axum` w…
383 - [`tracing-gelf`] implements a subscriber for exporting traces in Greylog
385 - [`tracing-coz`] provides integration with the [coz] causal profiler
387 - [`test-log`] takes care of initializing `tracing` for tests, based on
389 - [`tracing-unwrap`] provides convenience methods to report failed unwraps on `Result` or `Option` …
390 - [`diesel-tracing`] provides integration with [`diesel`] database connections.
391 - [`tracing-tracy`] provides a way to collect [Tracy] profiles in instrumented
393 - [`tracing-elastic-apm`] provides a layer for reporting traces to [Elastic APM].
394 - [`tracing-etw`] provides a layer for emitting Windows [ETW] events.
395 - [`tracing-fluent-assertions`] provides a fluent assertions-style testing
396 framework for validating the behavior of `tracing` spans.
397 - [`sentry-tracing`] provides a layer for reporting events and traces to [Sentry].
398 - [`tracing-loki`] provides a layer for shipping logs to [Grafana Loki].
399 - [`tracing-logfmt`] provides a layer that formats events and spans into the logfmt format.
401 If you're the maintainer of a `tracing` ecosystem crate not listed above,
404 [`tracing-timing`]: https://crates.io/crates/tracing-timing
405 [`tracing-opentelemetry`]: https://crates.io/crates/tracing-opentelemetry
407 [`tracing-honeycomb`]: https://crates.io/crates/tracing-honeycomb
408 [`tracing-distributed`]: https://crates.io/crates/tracing-distributed
410 [`tracing-actix`]: https://crates.io/crates/tracing-actix
412 [`tracing-gelf`]: https://crates.io/crates/tracing-gelf
413 [`tracing-coz`]: https://crates.io/crates/tracing-coz
416 [`tracing-unwrap`]: https://docs.rs/tracing-unwrap
418 [`diesel-tracing`]: https://crates.io/crates/diesel-tracing
419 [`tracing-tracy`]: https://crates.io/crates/tracing-tracy
421 [`tracing-elastic-apm`]: https://crates.io/crates/tracing-elastic-apm
423 [`tracing-etw`]: https://github.com/microsoft/tracing-etw
424 [ETW]: https://docs.microsoft.com/en-us/windows/win32/etw/about-event-tracing
425 [`tracing-fluent-assertions`]: https://crates.io/crates/tracing-fluent-assertions
426 [`sentry-tracing`]: https://crates.io/crates/sentry-tracing
428 [`tracing-loki`]: https://crates.io/crates/tracing-loki
430 [`tracing-logfmt`]: https://crates.io/crates/tracing-logfmt
433 undergoing active development. They may be less stable than `tracing` and
434 `tracing-core`.
437 [`tokio-rs/tracing`]: https://github.com/tokio-rs/tracing
438 [`tracing-futures`]: https://github.com/tokio-rs/tracing/tree/master/tracing-futures
439 [`tracing-subscriber`]: https://github.com/tokio-rs/tracing/tree/master/tracing-subscriber
440 [`tracing-log`]: https://github.com/tokio-rs/tracing/tree/master/tracing-log
442 [`FmtSubscriber`]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Subscrib…
443 [`examples`]: https://github.com/tokio-rs/tracing/tree/master/examples
447 Tracing is built against the latest stable release. The minimum supported
448 version is 1.56. The current Tracing version is not guaranteed to build on Rust
451 Tracing follows the same compiler support policies as the rest of the Tokio