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.
This commit is contained in:
Thomas Eizinger
2025-11-10 12:40:30 +11:00
committed by GitHub
parent 74bd28d25a
commit 123c5a5d97

View File

@@ -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
}