🚧 Feature/sentry.quartz (Quartz v4 Alpha version) - #5505
🚧 Feature/sentry.quartz (Quartz v4 Alpha version)#5505michaelmairegger wants to merge 22 commits into
Conversation
… dependencies and streamlining SentryCronJobListener options handling
# Conflicts: # .generated.NoMobile.sln # Sentry.sln
…and update Quartz integration
|
@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). |
… collection parameter and streamlining option configuration
…dSentryScope method, update SentryMetricsMiddleware to support configurable options
18ff2fe to
8e9c712
Compare
| string[] normalized = cronExpression.CronExpressionString | ||
| .Replace("?", "*", StringComparison.OrdinalIgnoreCase) | ||
| .Split(' ', StringSplitOptions.RemoveEmptyEntries); | ||
|
|
||
| options.Interval(string.Join(" ", normalized[1..6])); |
There was a problem hiding this comment.
Bug: The code incorrectly slices a normalized cron expression using normalized[1..6], which omits the 'minutes' field and passes a malformed cron string to Sentry, causing monitor creation to fail.
Severity: HIGH
Suggested Fix
Change the array slice from normalized[1..6] to normalized[0..5]. This will correctly extract the first five fields (minute, hour, day, month, weekday) to form a valid 5-field Unix cron expression as expected by Sentry.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/Sentry.Quartz/SentryCronJobMiddleware.cs#L104-L108
Potential issue: In the `UpsertCronMonitor` method, the code attempts to convert a
Quartz cron expression to a 5-field Unix format for Sentry. It correctly parses the
expression, resulting in a 6-field string (including seconds). However, it then uses an
incorrect array slice `normalized[1..6]` to extract the fields. This slice omits the
'minutes' field (at index 0) and creates a malformed 5-field string. This malformed
string is passed to `SentryMonitorOptions.Interval()`, which will cause a validation
failure and an `ArgumentException`. The exception is caught and logged, but it results
in the cron monitor failing to be created, silently breaking the feature.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 59fdcd8. Configure here.
c05a9f7 to
59fdcd8
Compare

This PR implements and showcases Quartz.Net integration for Sentry
Note: Quartz.Net v4 is still alpha, therefore we should wait until v4 is finally released.
fixes #4601