Skip to content

Commit ff38ecf

Browse files
thomasywangmeta-codesync[bot]
authored andcommitted
Create a Perfetto Sink (#2169)
Summary: Pull Request resolved: #2169 Create a TraceDispatcherSink that writes perfetto traces in their native protobuf format directly to local files The advantages include: - No row limits (vs 400k for a scuba query) - Zero ingestion latency (Traces are available immediately) - No json -> protobuf conversion needed and very compact - Compatibility with distributed file systems like OILFS - Faster execution of expanse: No more querying scuba and conversion of scuba -> perfetto protobuf Differential Revision: D89403329
1 parent 5b6fa6b commit ff38ecf

File tree

3 files changed

+680
-0
lines changed

3 files changed

+680
-0
lines changed

hyperactor_telemetry/src/lib.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,27 @@ fn initialize_logging_with_log_prefix_impl(
704704
}
705705
}
706706

707+
if hyperactor_config::global::get(sinks::perfetto::PERFETTO_TRACE_MODE)
708+
!= sinks::perfetto::PerfettoTraceMode::Off
709+
{
710+
let exec_id = env::execution_id();
711+
let process_name = std::env::var("HYPERACTOR_PROCESS_NAME")
712+
.unwrap_or_else(|_| "client".to_string());
713+
match sinks::perfetto::PerfettoFileSink::new(
714+
sinks::perfetto::default_trace_dir(),
715+
&exec_id,
716+
&process_name,
717+
) {
718+
Ok(sink) => {
719+
max_level = Some(tracing::level_filters::LevelFilter::TRACE);
720+
sinks.push(Box::new(sink));
721+
}
722+
Err(e) => {
723+
tracing::warn!("failed to create PerfettoFileSink: {}", e);
724+
}
725+
}
726+
}
727+
707728
{
708729
if hyperactor_config::global::get(ENABLE_OTEL_TRACING) {
709730
use crate::meta;

hyperactor_telemetry/src/sinks/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
//! writing events to a specific backend (SQLite, Scuba, glog, etc).
1212
1313
pub mod glog;
14+
pub mod perfetto;
1415
pub mod sqlite;

0 commit comments

Comments
 (0)