From 1a1d0111868191df22d28c44eea0137b51fa1e14 Mon Sep 17 00:00:00 2001 From: jrconlin Date: Mon, 12 Sep 2022 10:00:36 -0700 Subject: [PATCH] f add tags --- autoendpoint/src/middleware/sentry.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoendpoint/src/middleware/sentry.rs b/autoendpoint/src/middleware/sentry.rs index a014a412f..1dbb2e4e7 100644 --- a/autoendpoint/src/middleware/sentry.rs +++ b/autoendpoint/src/middleware/sentry.rs @@ -1,4 +1,5 @@ use crate::error::ApiError; +use crate::tags::Tags; use actix_web::dev::{Service, ServiceRequest, ServiceResponse}; use cadence::CountedExt; use sentry::protocol::Event; @@ -22,7 +23,7 @@ pub fn sentry_middleware( hub.configure_scope(|scope| { scope.add_event_processor(Box::new(move |event| process_event(event, &sentry_request))) }); - + let tags = Tags::from_request_head(request.head()); let state = request .app_data::>() .cloned(); @@ -53,7 +54,10 @@ pub fn sentry_middleware( } } debug!("Reporting error to Sentry (service error): {}", error); - let event_id = hub.capture_event(event_from_actix_error(&error)); + // TODO: extract and add extra data. + let mut event = event_from_actix_error(&error); + event.extra = tags.extra_tree(); + let event_id = hub.capture_event(event); trace!("event_id = {}", event_id); return Err(error); }