contrib/rust-sdk/tracing-perfetto/README.md
A tracing-subscriber Layer that
emits Perfetto track events via the
perfetto-sdk crate.
This bridges the Rust tracing ecosystem with Perfetto's native tracing
infrastructure. Spans become duration slices and events become instant
events, with full support for debug annotations, source locations, and
integration with the Perfetto tracing service.
use tracing_subscriber::prelude::*;
tracing_perfetto_sdk::init();
tracing_subscriber::registry()
.with(tracing_perfetto_sdk::PerfettoLayer::new())
.init();
let span = tracing::info_span!("my_function", arg = 42);
let _guard = span.enter();
tracing::info!("hello from Perfetto");
| Feature | Default | Description |
|---|---|---|
vendored | yes | Statically links the bundled Perfetto C library |
| Crate | Description |
|---|---|
perfetto-sdk | The underlying Perfetto SDK bindings |
tracing | The Rust tracing facade |
tracing-subscriber | Composable tracing subscriber layers |