Skip to content

feat(crons): Mark @monitor jobs so scheduler integrations skip them - #8198

Open
wedamija wants to merge 3 commits into
masterfrom
danf/crons-monitor-marker
Open

wedamija wants to merge 3 commits into
masterfrom
danf/crons-monitor-marker

Conversation

@wedamija

@wedamija wedamija commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Description

Marks functions wrapped with @sentry_sdk.monitor, so scheduler integrations can skip jobs that already send their own check-ins. The arq integration now does this, so those jobs don't report twice.

Also moves arq's time zone lookup into sentry_sdk/crons/utils.py so other cron integrations can share it, and stops sending names that aren't IANA zones (like tzlocal's local), which Sentry would reject.

This is the base for #7840 (APScheduler), which uses both.

Testing

New arq test for a @sentry_sdk.monitor cron job. The existing arq time zone tests cover the helper.

Functions wrapped with sentry_sdk.monitor get a marker, and arq skips cron
jobs that already report their own check-ins. The arq time zone lookup moves
to a shared helper that only sends names that look like IANA zones.
The worker can run the job again when a cron slot falls due during the test.
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 137221 passed | ⏭️ 7456 skipped | Total: 144677 | Pass Rate: 94.85% | Execution Time: 454m 59s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +7
Passed Tests 📈 +7
Failed Tests —
Skipped Tests —

All tests are passing successfully.

✅ Patch coverage is 95.83% (23 of 24 changed executable lines covered; target 80%).
Project statement coverage is 90.30% (down 0.03 percentage points from base (1baa462) to head (087f5ce)).

Changed files with executable lines (3)
File Patch coverage Changed executable lines
sentry_sdk/crons/utils.py 92.86% 13/14 covered; missed: 55; partial branches: 48
sentry_sdk/crons/decorator.py 100.00% 2/2 covered
sentry_sdk/integrations/arq.py 100.00% 8/8 covered
Coverage diff
@@            Coverage Diff             @@
##        master     #8198       +/-##
==========================================
- Coverage    90.33%    90.30%    -0.03%
==========================================
  Files          203       203         —
  Tracked lines     26922     26933       +11
  Branches     10056     10058        +2
==========================================
+ Hits         24319     24320        +1
- Misses        2603      2613       +10
- Partials      1516      1519        +3

Generated by Coverage Action

GitHub didn't sync the previous push to the PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant