-
-
Notifications
You must be signed in to change notification settings - Fork 522
Fix: Handle exception with large stacktrace without dropping entire item - by removing stacktrace #1806
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
Fix: Handle exception with large stacktrace without dropping entire item - by removing stacktrace #1806
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,26 @@ def serialize_envelope(envelope) | |
| result = item.to_s | ||
| end | ||
|
|
||
| if result.bytesize > Event::MAX_SERIALIZED_PAYLOAD_SIZE | ||
| if single_exceptions = item.payload.dig(:exception, :values) | ||
| single_exceptions.each do |single_exception| | ||
| traces = single_exception.dig(:stacktrace, :frames) | ||
| if traces && traces.size > 0 | ||
| single_exception.delete(:stacktrace) | ||
| end | ||
| end | ||
| elsif single_exceptions = item.payload.dig("exception", "values") | ||
| single_exceptions.each do |single_exception| | ||
| traces = single_exception.dig("stacktrace", "frames") | ||
| if traces && traces.size > 0 | ||
| single_exception.delete("stacktrace") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also don't have an answer for this yet, but I'd like to avoid duplicating all the payload truncation logic because of key types.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. python has some overly general serialization logic that drops fields based on nested hash breadth/depth/byte length logic, but I don't like that so much either because it's really hard to read. |
||
| end | ||
| end | ||
| end | ||
|
|
||
| result = item.to_s | ||
| end | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't comment lower so I just leave it here: we also need to update the message form: to |
||
| if result.bytesize > Event::MAX_SERIALIZED_PAYLOAD_SIZE | ||
| size_breakdown = item.payload.map do |key, value| | ||
| "#{key}: #{JSON.generate(value).bytesize}" | ||
|
|
||
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 changelog has been deprecated. Can you update the top-level one instead?