Skip to content

Commit

Permalink
f add tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jrconlin committed Sep 12, 2022
1 parent 25dcd3b commit 1a1d011
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions autoendpoint/src/middleware/sentry.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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::<actix_web::web::Data<crate::server::ServerState>>()
.cloned();
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 1a1d011

Please sign in to comment.