use separate but configurable envfilter for sentry
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
899b79873e
commit
5570220c89
2 changed files with 8 additions and 1 deletions
|
@ -362,6 +362,8 @@ pub struct Config {
|
|||
pub sentry_send_panic: bool,
|
||||
#[serde(default = "true_fn")]
|
||||
pub sentry_send_error: bool,
|
||||
#[serde(default = "default_sentry_filter")]
|
||||
pub sentry_filter: String,
|
||||
|
||||
#[serde(default)]
|
||||
pub tokio_console: bool,
|
||||
|
@ -831,6 +833,7 @@ impl fmt::Display for Config {
|
|||
line("Sentry.io attach stacktrace", &self.sentry_attach_stacktrace.to_string());
|
||||
line("Sentry.io send panics", &self.sentry_send_panic.to_string());
|
||||
line("Sentry.io send errors", &self.sentry_send_error.to_string());
|
||||
line("Sentry.io tracing filter", &self.sentry_filter);
|
||||
line(
|
||||
"Well-known server name",
|
||||
self.well_known
|
||||
|
@ -1075,4 +1078,6 @@ fn default_sentry_endpoint() -> Option<Url> {
|
|||
|
||||
fn default_sentry_traces_sample_rate() -> f32 { 0.15 }
|
||||
|
||||
fn default_sentry_filter() -> String { "info".to_owned() }
|
||||
|
||||
fn default_startup_netburst_keep() -> i64 { 50 }
|
||||
|
|
|
@ -32,8 +32,10 @@ pub(crate) fn init(config: &Config) -> Result<(LogLevelReloadHandles, TracingFla
|
|||
|
||||
#[cfg(feature = "sentry_telemetry")]
|
||||
let subscriber = {
|
||||
let sentry_filter = EnvFilter::try_new(&config.sentry_filter)
|
||||
.map_err(|e| Error::BadConfig(format!("in the 'sentry_filter' setting: {e}.")))?;
|
||||
let sentry_layer = sentry_tracing::layer();
|
||||
let (sentry_reload_filter, sentry_reload_handle) = reload::Layer::new(filter_layer.clone());
|
||||
let (sentry_reload_filter, sentry_reload_handle) = reload::Layer::new(sentry_filter);
|
||||
reload_handles.add("sentry", Box::new(sentry_reload_handle));
|
||||
subscriber.with(sentry_layer.with_filter(sentry_reload_filter))
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue