diff --git a/syncserver-common/src/middleware/sentry.rs b/syncserver-common/src/middleware/sentry.rs index 0ce2be81b2..8da8d4ffb2 100644 --- a/syncserver-common/src/middleware/sentry.rs +++ b/syncserver-common/src/middleware/sentry.rs @@ -14,15 +14,13 @@ use crate::{ReportableError, Taggable}; #[derive(Clone)] pub struct SentryWrapper { metrics: Arc, - metric_label: String, phantom: PhantomData, } impl SentryWrapper { - pub fn new(metrics: Arc, metric_label: String) -> Self { + pub fn new(metrics: Arc) -> Self { Self { metrics, - metric_label, phantom: PhantomData, } } @@ -44,7 +42,6 @@ where ok(SentryWrapperMiddleware { service: Rc::new(RefCell::new(service)), metrics: self.metrics.clone(), - metric_label: self.metric_label.clone(), phantom: PhantomData, }) } @@ -54,7 +51,6 @@ where pub struct SentryWrapperMiddleware { service: Rc>, metrics: Arc, - metric_label: String, phantom: PhantomData, } @@ -81,7 +77,6 @@ where // get the tag information let metrics = self.metrics.clone(); - let metric_label = self.metric_label.clone(); let tags = sreq.get_tags(); let extras = sreq.get_extras(); @@ -100,7 +95,7 @@ where // capture it, and then turn it off before we run out of money. if let Some(label) = reportable_err.metric_label() { debug!("Sentry: Sending error to metrics: {:?}", reportable_err); - let _ = metrics.incr(&format!("{}.{}", metric_label, label)); + let _ = metrics.incr(&label); } debug!("Sentry: Not reporting error (service error): {:?}", error); return Err(error); @@ -122,7 +117,7 @@ where if !reportable_err.is_sentry_event() { if let Some(label) = reportable_err.metric_label() { debug!("Sentry: Sending error to metrics: {:?}", reportable_err); - let _ = metrics.incr(&format!("{}.{}", metric_label, label)); + let _ = metrics.incr(&label); } debug!("Not reporting error (service error): {:?}", error); return Ok(response); diff --git a/syncserver/src/server/mod.rs b/syncserver/src/server/mod.rs index 55568b9d4a..93dfda9b05 100644 --- a/syncserver/src/server/mod.rs +++ b/syncserver/src/server/mod.rs @@ -88,10 +88,7 @@ macro_rules! build_app { // These will wrap all outbound responses with matching status codes. .wrap(ErrorHandlers::new().handler(StatusCode::NOT_FOUND, ApiError::render_404)) // These are our wrappers - .wrap(SentryWrapper::::new( - $metrics.clone(), - "api_error".to_owned(), - )) + .wrap(SentryWrapper::::new($metrics.clone())) .wrap_fn(middleware::weave::set_weave_timestamp) .wrap_fn(tokenserver::logging::handle_request_log_line) .wrap_fn(middleware::rejectua::reject_user_agent) @@ -199,7 +196,6 @@ macro_rules! build_app_without_syncstorage { .wrap(ErrorHandlers::new().handler(StatusCode::NOT_FOUND, ApiError::render_404)) .wrap(SentryWrapper::::new( $metrics.clone(), - "api_error".to_owned(), )) // These are our wrappers .wrap_fn(tokenserver::logging::handle_request_log_line)