This directory contains a collection of examples that demonstrate the use of the
counters: Implements a very simple metrics system to demonstrate how subscribers can consume field values as typed data.
sloggish: A demo
Subscriberimplementation that mimics the output of
attrs-basic: A simple example of the
attrs-args: An example implementing a simple recursive calculation of Fibonacci numbers, to demonstrate how the
#[instrument]attribute can record function arguments.
fmt: Demonstrates the use of the
tracing-subscriber, which provides a subscriber implementation that logs traces to the console.
fmt-stderr: Demonstrates overriding the output stream used by the
subscriber-filter: Demonstrates the
tracing-subscriber::filtermodule, which provides a layer which adds configurable filtering to a subscriber implementation.
tower-load: Demonstrates how dynamically reloadable filters can be used to debug a server under load in production.
futures-proxy-server: Demonstrates the use of
tracing-futuresby implementing a simple proxy server, based on this example from
futures-spawn: A simple demonstration of the relationship between the spans representing spawned futures.
serde-yak-shave: Demonstrates the use of
tracing-serdeby implementing a subscriber that emits trace output as JSON.
hyper-echo: Demonstrates how
tracing-logcan be used to record unstructured logs from dependencies as
tracingevents, by instrumenting this example from
hyper, and using
tracing-logto record logs emitted by
The nightly-examples directory contains examples of how
tracing can be used
with async/await. These are kept separate as async/await is currently only
available on nightly Rust toolchains.