GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(huey): Add an option to monitor Huey periodic tasks by wedamija · Pull Request #8052 · getsentry/sentry-python

Conversation

@wedamija

@wedamija wedamija commented Oct 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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 monitor_periodic_tasks to HueyIntegration, matching Celery's monitor_beat_tasks. When it's on, each @huey.periodic_task run sends check-ins with its crontab(...) schedule in UTC, so Sentry creates the monitor on the first run. The slug is the task name. It's off by default, and regular tasks are unaffected.

sentry_sdk.init(
    integrations=[HueyIntegration(monitor_periodic_tasks=True, exclude_periodic_tasks=["cleanup"])],
)

Tasks aren't monitored when they use a custom validate_datetime, restrict both day and day_of_week, or run on a Huey instance with utc=False.

Docs: getsentry/sentry-docs#20057

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@wedamija @claude
feat(huey): Add cron monitoring for Huey periodic tasks
4588cdd
Send check-ins around each run of a Huey periodic task when
HueyIntegration(monitor_periodic_tasks=True) is set. Huey crontab()
schedules are sent as the monitor config when Huey runs in UTC, so
Sentry creates the monitor and keeps it in sync.

Co-Authored-By: Claude <[email protected]>
@wedamija wedamija mentioned this pull request Oct 17, 2026
docs(crons): Add Huey setup for Python getsentry/sentry-docs#20057
Merged
1 of 3 tasks
@github-actions

github-actions Bot commented Oct 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 134017 passed | ⏭️ 7311 skipped | Total: 141328 | Pass Rate: 94.83% | Execution Time: 435m 22s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +3131
Passed Tests 📈 +3154
Failed Tests 📉 -58
Skipped Tests 📈 +35

➖ Removed Tests (58)

View removed tests
  • test_input_attributes_nonstreaming_chat[False-True-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-True-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[True-True-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[True-True-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[True-False-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[True-False-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[False-True-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[False-True-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[False-False-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[False-False-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[True-True-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[True-True-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[True-False-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[True-False-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[False-True-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[False-True-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[False-False-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[False-False-False]
    • File: tests.integrations.mistral.test_mistral

All tests are passing successfully.

✅ Patch coverage is 96.43% (54 of 56 changed executable lines covered; target 80%).
Project statement coverage is 90.28% (up 0.03 percentage points from base (0f7acd5) to head (cb9e9b4)).

Changed files with executable lines (1)
File Patch coverage Changed executable lines
sentry_sdk/integrations/huey.py 96.43% 54/56 covered; missed: 310, 340; partial branches: 309, 339
Coverage diff
@@            Coverage Diff             @@
##        master     #8052       +/-##
==========================================
+ Coverage    90.25%    90.28%    +0.03%
==========================================
  Files          202       202         —
  Tracked lines     26660     26793      +133
  Branches      9926      9994       +68
==========================================
+ Hits         24062     24189      +127
- Misses        2598      2604        +6
- Partials      1510      1516        +6

Generated by Coverage Action

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sentry-warden[bot]
sentry-warden Bot reviewed Oct 17, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/huey.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/integrations/huey/test_huey_crons.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

sentry-warden[bot]
sentry-warden Bot reviewed Oct 17, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/huey.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

sentrivana
sentrivana reviewed Oct 20, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/huey.py
_CRONTAB_CODE = crontab().__code__


def _get_closure_var(func: "Any", name: str) -> "Any":

@sentrivana sentrivana Oct 20, 2026

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constructing the monitor from code inspection like this feels brittle. Is there any other way we can get to it, e.g. by monkeypatching something (the crontab func maybe? haven't looked into it so don't know if feasible)?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@wedamija wedamija Oct 20, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this with Claude for a while and it seems like it's pretty hard to do this via monkeypatching.

Huey doesn't have a public schedule object. crontab() keeps the parsed values in a closure and returns a plain timestamp -> bool function. Since most users import crontab before sentry_sdk.init(), any module where it's imported will have the original instead of the monkeypatched one.

It's definitely brittle if they change these internals. If they do, we will catch this in ci within a week since we bump to the latest Huey on a weekly basis.

I'm open to other options though if you have any thoughts on how to make this better

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sentrivana sentrivana Oct 21, 2026

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking, I also briefly looked into it but didn't find a better way. Let's go with this then, and we'll monitor in the test matrix in CI.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@wedamija wedamija changed the title feat(huey): Add cron monitoring for Huey periodic tasks feat(huey): Add an option to monitor Huey periodic tasks Oct 20, 2026
@wedamija @claude
fix(huey): Send ok check-ins for retried, locked and cancelled runs
191a0c7
`RetryTask`, `TaskLockedException` and `CancelExecution` aren't failures
for Huey or for the integration's error capture, so they no longer mark
the check-in as an error.

Co-Authored-By: Claude <[email protected]>
sentry-warden[bot]
sentry-warden Bot reviewed Oct 20, 2026
View reviewed changes
Comment thread tests/integrations/huey/test_huey_crons.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

wedamija and others added 2 commits October 20, 2026 15:18
@wedamija @claude
fix(huey): Don't monitor periodic tasks with unsupported schedules
c878f07
Match the Celery beat integration: skip periodic tasks whose schedule
can't be expressed as a Sentry Crons monitor config instead of sending
check-ins without one.

Co-Authored-By: Claude <[email protected]>
@wedamija @claude
fix(huey): Send error check-ins for retried, locked and cancelled runs
cb9e9b4
Match Celery, which marks a retried beat task's check-in as an error.

Co-Authored-By: Claude <[email protected]>
@wedamija
wedamija marked this pull request as ready for review October 20, 2026 23:28
@wedamija
wedamija requested a review from a team as a code owner October 20, 2026 23:28
@wedamija
wedamija requested a review from sentrivana October 20, 2026 23:28
sentrivana
sentrivana approved these changes Oct 21, 2026
View reviewed changes
@sentrivana
sentrivana merged commit 1c249d8 into master Oct 21, 2026
168 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@sentrivana
sentrivana deleted the danf/huey-crons branch October 21, 2026 10:32
@wedamija wedamija mentioned this pull request Oct 21, 2026
fix(arq): Don't monitor cron jobs with unsupported schedules #8098
Merged
@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

PY-3031

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sentrivana pushed a commit that referenced this pull request Oct 22, 2026
@wedamija @claude
fix(arq): Don't monitor cron jobs with unsupported schedules (#8098)
68bc4dd
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 is a quick fix to keep the arq integration behaviour in line with
how other integrations work. Sorry for the churn!

Follow-up to #8051. Cron jobs whose schedule Crons can't express are no
longer monitored, instead of checking in without a config. This matches
Celery beat, and the Huey and RQ integrations from #8052 and #8053.

Docs: getsentry/sentry-docs#20056

Co-authored-by: Claude <[email protected]>
@sentry-release-bot sentry-release-bot Bot mentioned this pull request Oct 22, 2026
publish: getsentry/[email protected] getsentry/publish#9970
Closed
6 tasks done
sentrivana added a commit to getsentry/sentry-docs that referenced this pull request Oct 22, 2026
@wedamija @claude @sentrivana
docs(crons): Add Huey setup for Python (#20057)
7beb293
## DESCRIBE YOUR PR

Adds a Huey section to the Python Crons setup page: turning on
`monitor_periodic_tasks`, how the slug is picked, and which periodic
tasks are monitored.

SDK PR: getsentry/sentry-python#8052

Stacked on #20056.

Merge after the SDK release that includes it.

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Ivana Kellyer <[email protected]>
@sentry-release-bot sentry-release-bot Bot mentioned this pull request Oct 27, 2026
publish: getsentry/[email protected] getsentry/publish#10029
Closed
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sentrivana sentrivana sentrivana approved these changes
@sentry-warden sentry-warden[bot] sentry-warden[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@wedamija @sentrivana
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.