feat(python): Improve crons docs, add upserts#9597
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Bundle ReportChanges will decrease total bundle size by 6 bytes ⬇️
|
antonpirker
left a comment
There was a problem hiding this comment.
Not sure about a few things.
| ## Check-Ins | ||
|
|
||
| Check-in monitoring allows you to track a job's progress by capturing two check-ins: one at the start of your job and another at the end of your job. This two-step process allows Sentry to notify you if your job didn't start when expected (missed) or if it exceeded its maximum runtime (failed). | ||
|
|
||
| If you use the `monitor` decorator/context manager, the SDK will create check-ins for the wrapped code automatically. | ||
|
|
||
| ```python | ||
| from sentry_sdk.crons import capture_checkin | ||
| from sentry_sdk.crons.consts import MonitorStatus | ||
|
|
||
| check_in_id = capture_checkin( | ||
| monitor_slug='<monitor-slug>', | ||
| status=MonitorStatus.IN_PROGRESS, | ||
| ) | ||
|
|
||
| # Execute your task here... | ||
|
|
||
| capture_checkin( | ||
| monitor_slug='<monitor-slug>', | ||
| check_in_id=check_in_id, | ||
| status=MonitorStatus.OK, | ||
| ) | ||
| ``` |
There was a problem hiding this comment.
Not sure why this section is here. Maybe call it "Manual check-ins" and move it below the "Upserting Cron Monitors"
There was a problem hiding this comment.
Just copied the structure from https://docs.sentry.io/platforms/node/crons/ and https://docs.sentry.io/platforms/php/crons/ essentially. But agree this would be better below and renamed. Will do.
| ) | ||
| ``` | ||
|
|
||
| ## Upserting Cron Monitors |
There was a problem hiding this comment.
I would avoid the word "upsert" and rather call this section: "Adding cron monitor configuration options" or something like this. (and later in the text mention that when you add the monitor_config and no monitor is existing it is created.)
There was a problem hiding this comment.
Changed to Configuring Cron Monitors and added a sentence: If the monitor doesn't exist in Sentry yet, it will be created.
vivianyentran
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding!
|
Not released yet -- will merge as soon as there is a release out there with upsert support. |
Pre-merge checklist
If you work at Sentry, you're able to merge your own PR without review, but please don't unless there's a good reason.
Description of changes
With getsentry/sentry-python#2929 we'll be adding cron upserts to the Python SDK.
Also documenting manual check-ins which were missing.
Direct link to preview: https://sentry-docs-git-ivana-python-cron-upsert.sentry.dev/platforms/python/crons/
Extra resources