Repository navigation
feat: add Sentry.Quartz for cron monitoring of Quartz.NET 4.x jobs - #5505
Conversation
|
@jamescrosswell I will continue watching Quartz.Net alpha releases and adopt it until final bits of 4.0 will be released. |
Fantastic, thank you @michaelmairegger ! Maybe we mark the PR as draft until then? That let's me know it doesn't yet need my attention (you can always tag me directly if you want my input on something before v4 is released). |
18ff2fe to
8e9c712
Compare
c05a9f7 to
59fdcd8
Compare
|
@jamescrosswell quartz.net released final bits of v4. I updated the package to the final version and would say this first version of the package is feature complete. |
Nice - thanks @michaelmairegger. I wasn't expecting them to get v4 out so quickly! Apologies in advance... I might be a bis slow on reviewing - there's quite a but going on right now and the invention of AI has made it much easier for people to make PRs - so I'm spread a bit thin. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5505 +/- ##
==========================================
+ Coverage 75.82% 76.12% +0.30%
==========================================
Files 519 528 +9
Lines 19235 19579 +344
Branches 3741 3829 +88
==========================================
+ Hits 14584 14904 +320
- Misses 3781 3792 +11
- Partials 870 883 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The AddSentry() remarks still said job exceptions are left to the logging integration. The scope middleware has captured them again since 73e5551. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6bb5320. Configure here.
jamescrosswell
left a comment
There was a problem hiding this comment.
@wedamija very close now - I think the cursor comment/finding is legit. I suggested we adopt the same approach we did for Hangfire.
Other than that, just one leftover comment from the old implementation to clean up and I think we're good to go.
Nice, that we are close to finish. And I am glad my contribution will find its path to final release |
…schedules Reads every monitored trigger, cached for a minute, like Sentry.Hangfire. Replaces the check for jobs with several triggers.
A job without an identity has fallen back to its class name with a debug message, not a warning, since fe97276. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picks up getsentry#5757, which fixes the Blazor WASM E2E job on Ubuntu 26.04 runners. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Sorry for adding comments so late here @wedamija and @jamescrosswell! |
…gers A job left in a persistent store after its class was renamed or deleted made the whole trigger read throw, so no monitored job sent its schedule. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…aptured Co-Authored-By: Claude <noreply@anthropic.com>
…tion on Quartz's ErrorLogger logs the exception again, wrapped in a JobExecutionProcessException that the default DeduplicateMode doesn't unwrap. AddSentry now adds a log entry filter for that entry, to whichever SentryLoggingOptions the app uses (SentryAspNetCoreOptions included), when the middleware captured the inner exception. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
ric-oliv
left a comment
There was a problem hiding this comment.
One last suggestion from my side 🙏
Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
…log filter setup Co-Authored-By: Claude <noreply@anthropic.com>
jamescrosswell
left a comment
There was a problem hiding this comment.
Huge thanks to @michaelmairegger @wedamija and @ric-oliv for getting this over the line!
❤️

Changelog Entry
Sentry.Quartz, an integration for Quartz.NET 4.xservices.AddQuartz(q => q.AddSentry())runs each job in its own scope and trace, tagged with its job key, and captures the exceptions jobs throw[SentryMonitorSlug]send a Sentry Crons check-in for every run, with the trigger's cron or interval schedule as the monitor config, so monitors are created and kept up to date automaticallySentryQuartzOptions.ConfigureMonitorOptionscustomizes thresholds or the schedule, andSendMonitorConfig = falsesends check-ins without a scheduleDescription
Adds
Sentry.Quartz, a Quartz.NET 4.x integration built on Quartz's job middleware.Each job runs in its own Sentry scope and trace (unless global mode is enabled), tagged
quartz.jobwith its job key, and what it throws is captured in that scope. Quartz'sErrorLoggerlogs the same exception again, wrapped in aJobExecutionProcessException, which the SDK's default deduplication doesn't catch. So with Sentry's logging integration on, a log entry filter drops that entry, and each failure is captured once. Jobs with[SentryMonitorSlug]also send a check-in for each run: in progress when it starts, then ok or error with its duration. A cancelled run counts as an error.The monitor slug is the attribute's value, otherwise the slugified job key (
reports.DailyEmailbecomesreports-dailyemail). ASentryMonitorSlugentry in the job's or trigger's data map overrides both.The in-progress check-in carries the trigger's schedule as the monitor config, so monitors don't have to be created by hand. A schedule is only sent when Sentry reads it the same way Quartz does: cron triggers with a fixed seconds field, no year and no
L/W/#, and simple triggers that repeat forever at whole minutes, hours or days. Triggers with a calendar, and triggers that share a monitor slug but have different schedules, get check-ins without a schedule rather than one that would raise false missed check-in alerts. To spot shared slugs, the SDK reads every monitored trigger in the scheduler and reuses the result for a minute.Quartz 4 only targets net10.0, so this package does too. Quartz 3 support is in #5668, which compiles the same
Core/files against Quartz 3. The only change toSentryitself is an internalSentryMonitorOptions.HasScheduleandCopyTo, which letConfigureMonitorOptionsreplace the trigger's schedule. The filter needsSentryLoggingOptions, soSentry.Quartzdepends onSentry.Extensions.Logging. Dropping the duplicate with an exception filter inSentryinstead would avoid that dependency, but each dropped event would then show up as discarded in client reports. There's a sample insamples/Sentry.Samples.Quartz.Docs are in getsentry/sentry-docs#19790.
.craft.ymlpointsmainDocsUrlat the page that PR adds, so it should be merged before this is released.Closes #4601
🤖 Generated with Claude Code