docs(python): Add owner field examples to crons documentation#16825
docs(python): Add owner field examples to crons documentation#16825julwhitney13 wants to merge 1 commit intogetsentry:masterfrom
Conversation
|
@julwhitney13 is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
| # Assign ownership to a team or user (format: "team:6" or "user:51") | ||
| "owner": "team:6", |
There was a problem hiding this comment.
Bug: The documentation for the owner field uses numeric IDs (team:6), which contradicts the SDK specification that requires named identifiers (team:a-sentry-team), causing the feature to fail.
Severity: MEDIUM
Suggested Fix
Update the documentation examples to align with the official SDK specification. Use the string-based actor identifier format, such as owner="user:john@example.com" or owner="team:a-sentry-team", instead of numeric IDs. If the Python SDK implementation intentionally deviates from the specification, add a note to clarify this difference.
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: docs/platforms/python/crons/index.mdx#L40-L41
Potential issue: The documentation for the `owner` field in cron check-ins introduces
examples using numeric IDs, such as `"team:6"` and `"user:51"`. This format contradicts
the official Sentry SDK specification, which mandates the use of named identifiers like
`user:john@example.com` or `team:a-sentry-team`. If the Python SDK adheres to the
specification, users following this new documentation will provide an invalid format for
the `owner` field. This will likely cause the owner information to be silently ignored
or result in an API error, preventing users from correctly assigning ownership to their
cron monitors.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
The Sentry cron monitor API requires the owner field in the format "user:51" or "team:6" (numeric IDs), per the docs here: https://docs.sentry.io/api/crons/create-a-monitor/.
The Python SDK (PR) passes this through untouched to the API, so documenting the numeric ID format is accurate and matches what the API expects.
UPDATE
I checked API calling it with "owner": "team:my-team" and it returned
{"owner":["Could not parse actor. Format should be `type:id` where type is `team` or `user`."]}%
so documentation and code are correct as-is
There was a problem hiding this comment.
+1 to what @julwhitney13 , the documentation and code are correct as-is
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
ericapisani
left a comment
There was a problem hiding this comment.
Thanks for updating the docs alongside your changes!
I have one cleanup request, but otherwise this is looking great.
| You can also pass additional monitor configuration, including ownership: | ||
|
|
||
| ```python {diff} {filename:tasks.py} | ||
| +monitor_config = { | ||
| + "schedule": {"type": "crontab", "value": "0 0 * * *"}, | ||
| + "owner": "team:6", | ||
| +} | ||
|
|
||
| @app.task | ||
| +@sentry_sdk.monitor(monitor_slug='<monitor-slug>', monitor_config=monitor_config) | ||
| def tell_the_world(msg): | ||
| print(msg) | ||
| ``` |
There was a problem hiding this comment.
Because the information about additional monitor configuration is already available in the "Configuring Cron Monitors" section that you've edited above, we don't need to add these changes here.
DESCRIBE YOUR PR
Add documentation for the new
ownerfield in Python cron monitor configuration. This field allows developers to assign monitor ownership to teams or users(format:
"team:6"or"user:51") for improved discoverability and routing within Sentry organizations.Related SDK PR: getsentry/sentry-python#5609
Changes:
docs/platforms/python/crons/index.mdxto includeownerfield in monitor_config exampledocs/platforms/python/integrations/celery/crons.mdxto show usage with Celery tasksIS YOUR CHANGE URGENT?
SLA
Reviewers: @getsentry/docs (or specific docs team member if you know them)
PRE-MERGE CHECKLIST
LEGAL BOILERPLATE
I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.