diff --git a/crates/lib/docs_rs_logging/src/lib.rs b/crates/lib/docs_rs_logging/src/lib.rs index 3ed6efd7d..c7a6bc1b9 100644 --- a/crates/lib/docs_rs_logging/src/lib.rs +++ b/crates/lib/docs_rs_logging/src/lib.rs @@ -44,15 +44,21 @@ pub fn init_with_config(config: &Config) -> anyhow::Result { .with(config.filter.clone()); let sentry_guard = if let Some(sentry_config) = &config.sentry { - tracing::subscriber::set_global_default(tracing_registry.with( - sentry_tracing::layer().event_filter(|md| { - if md.fields().field("reported_to_sentry").is_some() { - sentry_tracing::EventFilter::Ignore - } else { - sentry_tracing::default_event_filter(md) - } - }), - ))?; + tracing::subscriber::set_global_default( + tracing_registry.with( + sentry_tracing::layer() + // Include HTTP trace-span fields (route, path, and response status) on child + // error events, making failures reported by tower-http actionable in Sentry. + .enable_span_attributes() + .event_filter(|md| { + if md.fields().field("reported_to_sentry").is_some() { + sentry_tracing::EventFilter::Ignore + } else { + sentry_tracing::default_event_filter(md) + } + }), + ), + )?; let sample_rate = sentry_config.traces_sample_rate; let traces_sampler = move |ctx: &TransactionContext| -> f32 {