Separate individual breadcrumb's data serialization#1250
Merged
Conversation
Breadcrumb can literally contain any type of data, and some of them can cause problems when being serialized, like a hash or array that contains circular references. Currently, this is causing the entire event to be ditched because of the serialization error or SystemStackError, which is bothering the users. However, to stop bad data from being recorded is almost impossible, or at least it'll be extremely expensive to check. So this commit takes a different approach: 1. we use `JSON.parse(JSON.generate(breadcrumb_data))` in `Breadcrumb#to_hash` to make sure the generated Hash is serializable. 2. if a breadcrumb's data is not serializable, the data will be thrown away but the breadcrumb will be preserved. 3. whenever the serialization error happens, Sentry will log related messages to help future debugging.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1250 +/- ##
==========================================
+ Coverage 97.88% 98.54% +0.66%
==========================================
Files 193 100 -93
Lines 8324 4550 -3774
==========================================
- Hits 8148 4484 -3664
+ Misses 176 66 -110 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breadcrumb can literally contain any type of data, and some of them can
cause problems when being serialized, like a hash or array that contains
circular references. Currently, this is causing the entire event to be
ditched because of the serialization error or SystemStackError, which is
bothering the users.
However, to stop bad data from being recorded is almost impossible, or at
least it'll be extremely expensive to check. So this commit takes a
different approach:
JSON.parse(JSON.generate(breadcrumb_data))inBreadcrumb#to_hashto make sure the generated Hash isserializable.
thrown away but the breadcrumb will be preserved.
messages to help future debugging.