add tracing_flame_filter config option
The previous hardcoded filter `trace,h2=off` isn't appropriate in all cases, it's better to have this be configurable.
This commit is contained in:
parent
cc578d9a67
commit
7d92515b1d
2 changed files with 10 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue