diff --git a/src/config/mod.rs b/src/config/mod.rs index b1a138bd5a037a054bfd10229736fe9c2255072a..c842b77068f447256bea61223da8720f1388d9ae 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -175,6 +175,9 @@ pub(crate) struct Config { #[serde(default)] #[cfg(feature = "perf_measurements")] pub(crate) tracing_flame: bool, + #[serde(default = "default_tracing_flame_filter")] + #[cfg(feature = "perf_measurements")] + pub(crate) tracing_flame_filter: String, #[serde(default)] pub(crate) proxy: ProxyConfig, pub(crate) jwt_secret: Option<String>, @@ -934,6 +937,9 @@ fn default_pusher_idle_timeout() -> u64 { 15 } fn default_max_fetch_prev_events() -> u16 { 100_u16 } +#[cfg(feature = "perf_measurements")] +fn default_tracing_flame_filter() -> String { "trace,h2=off".to_owned() } + fn default_trusted_servers() -> Vec<OwnedServerName> { vec![OwnedServerName::try_from("matrix.org").unwrap()] } fn default_log() -> String { diff --git a/src/main.rs b/src/main.rs index c7de0516d425a26b15e4c56bc877316a936df8e3..ef93a5a8a1eab76b0cd5bd41953d489719e4f81d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -617,7 +617,10 @@ fn init_tracing(config: &Config) -> LogLevelReloadHandles { #[cfg(feature = "perf_measurements")] let subscriber = { let flame_layer = if config.tracing_flame { - let flame_filter = EnvFilter::new("trace,h2=off"); + let flame_filter = match EnvFilter::try_new(&config.tracing_flame_filter) { + Ok(flame_filter) => flame_filter, + Err(e) => panic!("tracing_flame_filter config value is invalid: {e}"), + }; // TODO: actually preserve this guard until exit: https://docs.rs/tracing-flame/latest/tracing_flame/struct.FlameLayer.html#dropping-and-flushing let (flame_layer, _guard) = tracing_flame::FlameLayer::with_file("./tracing.folded").unwrap();