mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-28 05:45:48 +00:00
add config option tracing_flame_output_path
Hardcoding the output path to something in CWD is a pain if you're running conduwuit through systemd or similar. Also made the error message when it's unable to create the output file a little more friendly.
This commit is contained in:
parent
646b31d2bd
commit
56f1e905de
|
@ -178,6 +178,9 @@ pub(crate) struct Config {
|
|||
#[serde(default = "default_tracing_flame_filter")]
|
||||
#[cfg(feature = "perf_measurements")]
|
||||
pub(crate) tracing_flame_filter: String,
|
||||
#[serde(default = "default_tracing_flame_output_path")]
|
||||
#[cfg(feature = "perf_measurements")]
|
||||
pub(crate) tracing_flame_output_path: String,
|
||||
#[serde(default)]
|
||||
pub(crate) proxy: ProxyConfig,
|
||||
pub(crate) jwt_secret: Option<String>,
|
||||
|
@ -940,6 +943,9 @@ 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_tracing_flame_output_path() -> String { "./tracing.folded".to_owned() }
|
||||
|
||||
fn default_trusted_servers() -> Vec<OwnedServerName> { vec![OwnedServerName::try_from("matrix.org").unwrap()] }
|
||||
|
||||
fn default_log() -> String {
|
||||
|
|
|
@ -630,7 +630,13 @@ fn init_tracing(config: &Config) -> (LogLevelReloadHandles, TracingFlameGuard) {
|
|||
Err(e) => panic!("tracing_flame_filter config value is invalid: {e}"),
|
||||
};
|
||||
|
||||
let (flame_layer, flame_guard) = tracing_flame::FlameLayer::with_file("./tracing.folded").unwrap();
|
||||
let (flame_layer, flame_guard) =
|
||||
match tracing_flame::FlameLayer::with_file(&config.tracing_flame_output_path) {
|
||||
Ok(ok) => ok,
|
||||
Err(e) => {
|
||||
panic!("failed to initialize tracing-flame: {e}");
|
||||
},
|
||||
};
|
||||
let flame_layer = flame_layer
|
||||
.with_empty_samples(false)
|
||||
.with_filter(flame_filter);
|
||||
|
|
Loading…
Reference in a new issue