#tracing-layer #trace-logging #perfetto #tracing-subscriber #subscriber #tracing

tracing-perfetto

Tracing layer for recording spans and events as perfetto event format

6 releases

0.1.5 Jan 2, 2025
0.1.4 Dec 30, 2024
0.1.3 Nov 25, 2024
0.1.1 Jul 2, 2024

#231 in Debugging

Download history 482/week @ 2024-10-01 749/week @ 2024-10-08 655/week @ 2024-10-15 586/week @ 2024-10-22 653/week @ 2024-10-29 687/week @ 2024-11-05 520/week @ 2024-11-12 729/week @ 2024-11-19 531/week @ 2024-11-26 551/week @ 2024-12-03 652/week @ 2024-12-10 608/week @ 2024-12-17 528/week @ 2024-12-24 677/week @ 2024-12-31 1493/week @ 2025-01-07 628/week @ 2025-01-14

3,445 downloads per month
Used in sparkles

MIT license

1.5MB
26K SLoC

tracing-perfetto

Overview

tracing-perfetto is a Layer for tracing-subscriber that outputs traces in perfetto"s trace packet format that can be viewed with ui.perfetto.dev.

Usage

Add this near the beginning of main:

use tracing_perfetto::PerfettoLayer;
use tracing_subscriber::{registry::Registry, prelude::*};

let layer = PerfettoLayer::new(std::sync::Mutex::new(std::fs::File::create("/tmp/test.pftrace").unwrap()));
tracing_subscriber::registry().with(layer).init();

Open that file with ui.perfetto.dev:

Upgrade perfetto_trace.proto

  1. Download the latest perfetto_trace.proto into protos/peffetto_trace.proto.

  2. Run upgrade.rs

    • Windows cargo +nightly -Zscript upgrade.rs
    • *nix ./upgrade.rs
  3. Create a pull request with the changes.

License

Licensed under the MIT license

Dependencies

~3.5MB
~54K SLoC