Exclude the HTTP server response events from Sentry
This commit is contained in:
@@ -128,9 +128,11 @@ async fn try_main() -> anyhow::Result<ExitCode> {
|
||||
|
||||
let sentry_layer = sentry.is_enabled().then(|| {
|
||||
sentry_tracing::layer().event_filter(|md| {
|
||||
// All the spans in the handlers module send their data to Sentry themselves, so
|
||||
// we only create breadcrumbs for them, instead of full events
|
||||
if md.target().starts_with("mas_handlers::") {
|
||||
// By default, Sentry records all events as breadcrumbs, except errors.
|
||||
//
|
||||
// Because we're emitting error events for 5xx responses, we need to exclude
|
||||
// them and also record them as breadcrumbs.
|
||||
if md.name() == "http.server.response" {
|
||||
EventFilter::Breadcrumb
|
||||
} else {
|
||||
sentry_tracing::default_event_filter(md)
|
||||
|
||||
Reference in New Issue
Block a user