Skip to content

Commit cc5c264

Browse files
authored
[scheduler] Add sqlx warnings as sentry events (#2250)
## Related Issues sqlx warnings should be tracked by sentry ## Summarize your change. Treat sentry sqlx warnings as events <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Enhanced error monitoring with improved categorization of logs and errors to better distinguish critical issues from routine entries, resulting in more effective incident detection and troubleshooting. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 86b9164 commit cc5c264

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

rust/crates/scheduler/src/main.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,16 @@ async fn async_main() -> miette::Result<()> {
293293
};
294294
let subs = subs.with(file_appender_layer);
295295

296-
let sentry_layer = sentry::integrations::tracing::layer();
296+
let sentry_layer = sentry::integrations::tracing::layer().event_filter(|metadata| {
297+
// Register sqlx WARN messages as Sentry issues (events) instead of breadcrumbs
298+
if (metadata.target().starts_with("sqlx") && *metadata.level() == tracing::Level::WARN)
299+
|| metadata.level() <= &tracing::Level::ERROR
300+
{
301+
sentry::integrations::tracing::EventFilter::Event
302+
} else {
303+
sentry::integrations::tracing::EventFilter::Breadcrumb
304+
}
305+
});
297306
let subs = subs.with(sentry_layer);
298307

299308
tracing::subscriber::set_global_default(subs).expect("Unable to set global subscriber");

0 commit comments

Comments
 (0)