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 — fix(crons): Return `None` from `capture_checkin` when nothing is sent by HardMax71 · Pull Request #7868 · getsentry/sentry-python

Conversation

@HardMax71

@HardMax71 HardMax71 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Description

capture_checkin returned a check-in id even when the check-in wasn't sent, because it ignored the return value of capture_event. That happens when there is no active client, or when before_send drops the event. A caller that hands the id to another process (as in the issue: the scheduler opens the check-in, the worker closes it, and opens its own only when no id arrives) can't tell that the check-in never reached Sentry.

It now returns None in that case, the same way capture_event does. monitor and the Celery Beat integration pass the returned id into the closing capture_checkin call, which generates a new id when it gets None, so they behave as before. The return type becomes Optional[str], so type-checked code that uses the result as a str will now get a mypy error until it handles None. test_capture_checkin_sdk_not_initialized expected the passed-in id back when the SDK isn't initialized and now expects None.

The alternative was keeping the str return type and adding a separate way to ask whether the check-in went out, but None matches capture_event and needs no new API.

Issues

  • resolves: capture_checkin returns a check-in id even when the check-in was not sent #7845
  • resolves: PY-2924

Sorry, something went wrong.

Uh oh!

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

All reactions
@HardMax71
fix(crons): Return None from capture_checkin when nothing is sent
0d214e6
Return None when capture_event does not send the check-in, because there
is no active client or before_send drops the event. Previously the
generated or passed-in id came back either way, so a caller that hands
the id to another process could not tell that the check-in never reached
Sentry.

Fixes GH-7845
@HardMax71 HardMax71 mentioned this pull request Oct 5, 2026
capture_checkin returns a check-in id even when the check-in was not sent #7845
Closed
ericapisani
ericapisani requested changes Oct 5, 2026
View reviewed changes

@ericapisani ericapisani left a comment

Copy link
Copy Markdown
Member

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 opening this PR! I noticed something while reviewing this, take a look below.

When you're ready for me to take another look with an eye towards merging this in, mark the pull request as "ready to review" and I'll run the workflows and get it across the finish line.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread tests/test_crons.py Resolved

Uh oh!

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

@HardMax71
test(crons): Cover the monitor exit check-in after a dropped enter
99ec2d8
Test written by ericapisani in review.
@HardMax71
HardMax71 marked this pull request as ready for review October 5, 2026 16:57
@HardMax71
HardMax71 requested a review from a team as a code owner October 5, 2026 16:57
ericapisani
ericapisani approved these changes Oct 5, 2026
View reviewed changes

@ericapisani ericapisani left a comment

Copy link
Copy Markdown
Member

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 again!

Sorry, something went wrong.

Uh oh!

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

All reactions
@ericapisani
ericapisani merged commit 6a4eb20 into getsentry:master Oct 5, 2026
309 of 311 checks passed

Uh oh!

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

@sentry-release-bot sentry-release-bot Bot mentioned this pull request Oct 12, 2026
publish: getsentry/[email protected] getsentry/publish#9830
Closed
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ericapisani ericapisani ericapisani approved these changes

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.

capture_checkin returns a check-in id even when the check-in was not sent

Uh oh!

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

2 participants

@HardMax71 @ericapisani
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.