mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
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:
@@ -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"]
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user