-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore(preprod): Alert to Sentry on PreprodArtifact expiration #102804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(preprod): Alert to Sentry on PreprodArtifact expiration #102804
Conversation
| sentry_sdk.capture_message( | ||
| f"PreprodArtifact expired: artifact_id={artifact_id}", | ||
| level="error", | ||
| extras={ | ||
| "artifact_id": artifact_id, | ||
| }, | ||
| ) |
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.
Bug: sentry_sdk.capture_message() is called with an unsupported extras= keyword argument, leading to a TypeError.
Severity: HIGH | Confidence: 1.00
🔍 Detailed Analysis
The sentry_sdk.capture_message() function is invoked with an unsupported extras= keyword argument. This occurs within the detect_expired_preprod_artifacts() task when expired artifacts are identified and a Sentry message is attempted. The invocation will raise a TypeError at runtime, causing the task to crash and preventing the Sentry alert for expired artifacts from being sent. This hinders monitoring of artifact expiration issues.
💡 Suggested Fix
Remove the extras= parameter from the sentry_sdk.capture_message() call. Instead, use sentry_sdk.get_current_scope().set_extra("artifact_id", artifact_id) before calling capture_message() to attach extra data.
🤖 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: src/sentry/preprod/tasks.py#L645-L651
Potential issue: The `sentry_sdk.capture_message()` function is invoked with an
unsupported `extras=` keyword argument. This occurs within the
`detect_expired_preprod_artifacts()` task when expired artifacts are identified and a
Sentry message is attempted. The invocation will raise a `TypeError` at runtime, causing
the task to crash and preventing the Sentry alert for expired artifacts from being sent.
This hinders monitoring of artifact expiration issues.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
This will be passed as scope_kwargs and per the docs in the internal SDK calls, is both supported and will be just appended to the message:
:param scope_kwargs: Optional data to apply to event.
For supported `**scope_kwargs` see :py:meth:`sentry_sdk.Scope.update_from_kwargs`.
The `scope` and `scope_kwargs` parameters are mutually exclusive.
Had a recent upload fail to process due to a hang. We never received an alert directly from the point of the hang (separate issue), but we do have a fallthrough to catch hanging artifacts. This wires up a [custom message](https://docs.sentry.io/platforms/python/usage/#capturing-messages) which will create an issue for each hung artifact we catch. Resolves EME-600
Had a recent upload fail to process due to a hang. We never received an alert directly from the point of the hang (separate issue), but we do have a fallthrough to catch hanging artifacts. This wires up a [custom message](https://docs.sentry.io/platforms/python/usage/#capturing-messages) which will create an issue for each hung artifact we catch. Resolves EME-600

Had a recent upload fail to process due to a hang. We never received an alert directly from the point of the hang (separate issue), but we do have a fallthrough to catch hanging artifacts. This wires up a custom message which will create an issue for each hung artifact we catch.
Resolves EME-600