mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-27 11:45:23 +00:00
use separate configurable jaeger envfilter
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
5570220c89
commit
a35b6cbfdd
|
@ -183,6 +183,9 @@ pub struct Config {
|
|||
#[serde(default)]
|
||||
#[cfg(feature = "perf_measurements")]
|
||||
pub allow_jaeger: bool,
|
||||
#[serde(default = "default_jaeger_filter")]
|
||||
#[cfg(feature = "perf_measurements")]
|
||||
pub jaeger_filter: String,
|
||||
#[serde(default)]
|
||||
#[cfg(feature = "perf_measurements")]
|
||||
pub tracing_flame: bool,
|
||||
|
@ -979,6 +982,14 @@ fn default_max_fetch_prev_events() -> u16 { 100_u16 }
|
|||
#[cfg(feature = "perf_measurements")]
|
||||
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")]
|
||||
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)
|
||||
};
|
||||
|
||||
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(|| {
|
||||
opentelemetry::global::set_text_map_propagator(opentelemetry_jaeger::Propagator::new());
|
||||
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)
|
||||
.expect("jaeger agent pipeline");
|
||||
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));
|
||||
Some(telemetry.with_filter(jaeger_reload_filter))
|
||||
});
|
||||
|
||||
let subscriber = subscriber.with(flame_layer).with(jaeger_layer);
|
||||
(subscriber, flame_guard)
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue