From 123c5a5d9750c2b11b08885b8ca9aef6807ad608 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 10 Nov 2025 12:40:30 +1100 Subject: [PATCH] chore(connlib): always include `wire::api` as Sentry breadcrumb (#10821) Sentry appends "breadcrumbs" to every error that gets sent to the backend. By default, those include the last 500 DEBUG logs. Our `phoenix_channel` module logs the incoming and outgoing messages on TRACE using the `wire::api::send` and `wire::api::recv` targets. To make debugging these easier, we always include anything on `wire::api` in the breadcrumbs. --- rust/logging/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rust/logging/src/lib.rs b/rust/logging/src/lib.rs index 0f7df33ac..8e6ddcca3 100644 --- a/rust/logging/src/lib.rs +++ b/rust/logging/src/lib.rs @@ -20,7 +20,7 @@ use tracing::{Subscriber, subscriber::DefaultGuard}; use tracing_log::LogTracer; use tracing_subscriber::{ EnvFilter, Layer, Registry, - filter::{FilterExt, ParseError}, + filter::{FilterExt, ParseError, Targets}, fmt, layer::SubscriberExt as _, registry::LookupSpan, @@ -217,6 +217,8 @@ where { use tracing::Level; + let wire_api_target = Targets::new().with_target("wire::api", tracing::Level::TRACE); + sentry_tracing::layer() .event_filter(move |md| { let mut event_filter = match *md.level() { @@ -225,6 +227,10 @@ where Level::TRACE => EventFilter::Ignore, }; + if wire_api_target.would_enable(md.target(), md.level()) { + event_filter |= EventFilter::Breadcrumb; + } + if feature_flags::stream_logs(md) { event_filter |= EventFilter::Log }