-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(taskworker) Remove pickle usage from sentryapps task #91372
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
Conversation
The `event` parameter of process_service_hook requires pickle. By generating the payload before spawning a task, we don't have to use pickle. Refs SENTRY-3V47
process_service_hook.delay( | ||
servicehook_id=servicehook_id, | ||
project_id=event.project_id, | ||
event=event, | ||
payload=payload, | ||
) |
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.
Because process_service_hook
already supports kwargs
we can provide the new args at the same time as expanding the signature.
if not payload: | ||
if servicehook.version == 0: | ||
payload = json.dumps(get_payload_v0(event)) | ||
else: | ||
raise NotImplementedError |
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.
Passing in the serialized payload as a string saves us pickle + two json.dumps calls here 🚀
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #91372 +/- ##
==========================================
- Coverage 87.64% 87.63% -0.01%
==========================================
Files 10328 10330 +2
Lines 586134 586295 +161
Branches 22628 22628
==========================================
+ Hits 513713 513826 +113
- Misses 71994 72042 +48
Partials 427 427 |
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.
Makes sense to me, we're replacing the event parameter/var with the serialized payload.
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
PR reverted: dfe6a25 |
)" This reverts commit 81d0180. Co-authored-by: markstory <24086+markstory@users.noreply.github.com>
Redo of #91372 which was reverted because of rate limiting. This time around, use an option to control task variants, and only generate a payload when a hook is going to be sent. For projects with multiple service hooks, this should result in fewer snuba calls as events are only serialized once.
The `event` parameter of process_service_hook requires pickle. By generating the payload before spawning a task, we don't have to use pickle. Refs SENTRY-3V47
)" This reverts commit 81d0180. Co-authored-by: markstory <24086+markstory@users.noreply.github.com>
Redo of #91372 which was reverted because of rate limiting. This time around, use an option to control task variants, and only generate a payload when a hook is going to be sent. For projects with multiple service hooks, this should result in fewer snuba calls as events are only serialized once.
The
event
parameter of process_service_hook requires pickle. By generating the payload before spawning a task, we don't have to use pickle.Refs SENTRY-3V47