use separate configurable jaeger envfilter
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
5570220c89
commit
a35b6cbfdd
2 changed files with 15 additions and 1 deletions
|
@ -183,6 +183,9 @@ pub struct Config {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[cfg(feature = "perf_measurements")]
|
#[cfg(feature = "perf_measurements")]
|
||||||
pub allow_jaeger: bool,
|
pub allow_jaeger: bool,
|
||||||
|
#[serde(default = "default_jaeger_filter")]
|
||||||
|
#[cfg(feature = "perf_measurements")]
|
||||||
|
pub jaeger_filter: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[cfg(feature = "perf_measurements")]
|
#[cfg(feature = "perf_measurements")]
|
||||||
pub tracing_flame: bool,
|
pub tracing_flame: bool,
|
||||||
|
@ -979,6 +982,14 @@ fn default_max_fetch_prev_events() -> u16 { 100_u16 }
|
||||||
#[cfg(feature = "perf_measurements")]
|
#[cfg(feature = "perf_measurements")]
|
||||||
fn default_tracing_flame_filter() -> String { "trace,h2=off".to_owned() }
|
fn default_tracing_flame_filter() -> String { "trace,h2=off".to_owned() }
|
||||||
|
|
||||||
|
#[cfg(feature = "perf_measurements")]
|
||||||
|
fn default_jaeger_filter() -> String {
|
||||||
|
cfg!(debug_assertions)
|
||||||
|
.then_some("trace,h2=off")
|
||||||
|
.unwrap_or("info")
|
||||||
|
.to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "perf_measurements")]
|
#[cfg(feature = "perf_measurements")]
|
||||||
fn default_tracing_flame_output_path() -> String { "./tracing.folded".to_owned() }
|
fn default_tracing_flame_output_path() -> String { "./tracing.folded".to_owned() }
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,8 @@ pub(crate) fn init(config: &Config) -> Result<(LogLevelReloadHandles, TracingFla
|
||||||
(None, None)
|
(None, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let jaeger_filter = EnvFilter::try_new(&config.jaeger_filter)
|
||||||
|
.map_err(|e| Error::BadConfig(format!("in the 'jaeger_filter' setting: {e}.")))?;
|
||||||
let jaeger_layer = config.allow_jaeger.then(|| {
|
let jaeger_layer = config.allow_jaeger.then(|| {
|
||||||
opentelemetry::global::set_text_map_propagator(opentelemetry_jaeger::Propagator::new());
|
opentelemetry::global::set_text_map_propagator(opentelemetry_jaeger::Propagator::new());
|
||||||
let tracer = opentelemetry_jaeger::new_agent_pipeline()
|
let tracer = opentelemetry_jaeger::new_agent_pipeline()
|
||||||
|
@ -63,10 +65,11 @@ pub(crate) fn init(config: &Config) -> Result<(LogLevelReloadHandles, TracingFla
|
||||||
.install_batch(opentelemetry_sdk::runtime::Tokio)
|
.install_batch(opentelemetry_sdk::runtime::Tokio)
|
||||||
.expect("jaeger agent pipeline");
|
.expect("jaeger agent pipeline");
|
||||||
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
|
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
|
||||||
let (jaeger_reload_filter, jaeger_reload_handle) = reload::Layer::new(console_filter.clone());
|
let (jaeger_reload_filter, jaeger_reload_handle) = reload::Layer::new(jaeger_filter.clone());
|
||||||
reload_handles.add("jaeger", Box::new(jaeger_reload_handle));
|
reload_handles.add("jaeger", Box::new(jaeger_reload_handle));
|
||||||
Some(telemetry.with_filter(jaeger_reload_filter))
|
Some(telemetry.with_filter(jaeger_reload_filter))
|
||||||
});
|
});
|
||||||
|
|
||||||
let subscriber = subscriber.with(flame_layer).with(jaeger_layer);
|
let subscriber = subscriber.with(flame_layer).with(jaeger_layer);
|
||||||
(subscriber, flame_guard)
|
(subscriber, flame_guard)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue