feat: add tracing-tracy (#20958)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
DaniPopes
2026-01-12 18:37:37 +00:00
committed by GitHub
parent 2663942b50
commit 23f3f8e820
17 changed files with 101 additions and 9 deletions

View File

@@ -82,6 +82,7 @@ jemalloc = ["reth-cli-util/jemalloc"]
asm-keccak = ["alloy-primitives/asm-keccak"]
keccak-cache-global = ["alloy-primitives/keccak-cache-global"]
otlp = ["reth-tracing/otlp"]
tracy = ["reth-tracing/tracy"]
min-error-logs = ["tracing/release_max_level_error"]
min-warn-logs = ["tracing/release_max_level_warn"]

View File

@@ -75,6 +75,20 @@ pub struct LogArgs {
)]
pub samply_filter: String,
/// Emit traces to tracy. Only useful when profiling.
#[arg(long = "log.tracy", global = true, hide = true)]
pub tracy: bool,
/// The filter to use for traces emitted to tracy.
#[arg(
long = "log.tracy.filter",
value_name = "FILTER",
global = true,
default_value = "debug",
hide = true
)]
pub tracy_filter: String,
/// Sets whether or not the formatter emits ANSI terminal escape codes for colors and other
/// text formatting.
#[arg(
@@ -148,6 +162,12 @@ impl LogArgs {
tracer = tracer.with_samply(config);
}
#[cfg(feature = "tracy")]
if self.tracy {
let config = self.layer_info(LogFormat::Terminal, self.tracy_filter.clone(), false);
tracer = tracer.with_tracy(config);
}
let guard = tracer.init_with_layers(layers)?;
Ok(guard)
}