Repository navigation
Conversation
Opt-in via UseSentry(o => o.SendRecurringJobSchedule = true). The in-progress check-in of a recurring job carries the job's cron and time zone so Sentry can create the monitor. Unsupported schedules fall back to a check-in without config. Co-Authored-By: Claude <noreply@anthropic.com>
Check the crontab up front so the check-in goes out in a single call instead of relying on the hub to swallow an exception from Interval. The validator is shared with Sentry.Hangfire as a linked source file, since the unsigned assembly can't see Sentry's internals. Read the job through GetRecurringJobs, look up time zones with FindSystemTimeZoneById on .NET 6+, and add tests for UTC, unknown zones, deleted jobs, the UseSentry overload, and a real recurring job. Co-Authored-By: Claude <noreply@anthropic.com>
The linux-musl CI containers have no time zone database, so lookups of Europe/Berlin and Etc/UTC fail there. Co-Authored-By: Claude <noreply@anthropic.com>
Hangfire runs a job only on days that match both the day-of-month and day-of-week fields, while Sentry runs it on days that match either unless one of them starts with '*'. Don't send those schedules, nor ones with a reversed range such as 5-1 or SAT-SUN, which Sentry rejects. Co-Authored-By: Claude <noreply@anthropic.com>
Jobs are only monitored when they have [SentryMonitorSlug], so sending the recurring job's schedule lets Sentry create or update the monitor, like the Spring and Quartz integrations. Set SendRecurringJobSchedule to false to keep managing the schedule in Sentry. Co-Authored-By: Claude <noreply@anthropic.com>
The final check-in reused the ID returned for the in-progress one, which is empty when that one isn't captured. Create the ID up front, send it with the in-progress check-in, and store it in the job's items as before. Co-Authored-By: Claude <noreply@anthropic.com>
Matches SentryQuartzOptions.SendMonitorConfig. Co-Authored-By: Claude <noreply@anthropic.com>
… a slug with different schedules
…n cached schedule Co-Authored-By: Claude <noreply@anthropic.com>
MonitorAllRecurringJobs sends check-ins for recurring jobs without SentryMonitorSlugAttribute, using the slugified recurring job ID as the monitor slug. ExcludedRecurringJobs leaves out recurring jobs by ID. Co-Authored-By: Claude <noreply@anthropic.com>
1 of 3 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5742 +/- ##
==========================================
+ Coverage 76.13% 76.14% +0.01%
==========================================
Files 528 529 +1
Lines 19579 19612 +33
Branches 3829 3837 +8
==========================================
+ Hits 14906 14934 +28
- Misses 3791 3797 +6
+ Partials 882 881 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…on-merge # Conflicts: # src/Sentry.Hangfire/GlobalConfigurationExtensions.cs # src/Sentry.Hangfire/SentryHangfireOptions.cs # test/Sentry.Hangfire.Tests/HangfireTests.cs # test/Sentry.Hangfire.Tests/ServerFilterTests.cs
wedamija
marked this pull request as ready for review
October 20, 2026 17:25
Collapse runs of hyphens and trim underscores, so IDs that Sentry would store under the same slug also share one here and the conflicting schedule check sees them. Co-Authored-By: Claude <noreply@anthropic.com>
jamescrosswell
left a comment
Collaborator
There was a problem hiding this comment.
@wedamija generally looks good. I made a couple of suggestions that I think are worth implementing though.
…ecurringJobs Adds a public StringOrRegex.Regex, since Sentry.Hangfire isn't strong-named and can't see Sentry's internals. Co-Authored-By: Claude <noreply@anthropic.com>
…nd Quartz Quartz now joins a job's group and name with a hyphen, since Relay drops dots. Co-Authored-By: Claude <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of a series adding automatic Crons monitoring for the most-used job schedulers in each SDK. Check-ins for a monitor that doesn't exist yet are dropped, so today each monitor has to be created by hand with its schedule copied from the code. Sending the job's schedule as the monitor config lets Sentry create the monitor and keep it in sync.
This adds
MonitorAllRecurringJobs, which sends check-ins for every recurring job without adding[SentryMonitorSlug]to each one. The monitor slug comes from the recurring job ID, andExcludedRecurringJobsleaves out jobs by exact ID. Jobs with[SentryMonitorSlug]keep their slug. Off by default.Schedules that can't be converted, and recurring jobs whose IDs map to the same slug with different schedules, check in without a config. Jobs that aren't recurring (
BackgroundJob.Enqueue) still need the attribute.Closes #5761