RUM-2459: Safe serialization of user-provided attributes#1818
Merged
0xnm merged 2 commits intoJan 12, 2024
Merged
Conversation
0xnm
force-pushed
the
nogorodnikov/rum-2459/safe-serialization-of-user-provided-properties
branch
2 times, most recently
from
January 11, 2024 16:52
16ba574 to
2c56536
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #1818 +/- ##
===========================================
+ Coverage 83.49% 83.49% +0.01%
===========================================
Files 467 467
Lines 16412 16448 +36
Branches 2482 2482
===========================================
+ Hits 13702 13733 +31
- Misses 2032 2037 +5
Partials 678 678
|
fuzzybinary
approved these changes
Jan 11, 2024
Member
|
I may want to pull similar functionality into the Flutter SDK, specifically for calling the Mapper. Is the |
xgouchet
approved these changes
Jan 12, 2024
Member
Author
|
@fuzzybinary |
0xnm
force-pushed
the
nogorodnikov/rum-2459/safe-serialization-of-user-provided-properties
branch
from
January 12, 2024 08:08
2c56536 to
5a32640
Compare
0xnm
force-pushed
the
nogorodnikov/rum-2459/safe-serialization-of-user-provided-properties
branch
from
January 12, 2024 08:29
5a32640 to
ef60e47
Compare
0xnm
deleted the
nogorodnikov/rum-2459/safe-serialization-of-user-provided-properties
branch
January 12, 2024 08:53
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.
What does this PR do?
This PR brings safer serialization of user-provided attributes, so that any exception thrown during this process won't discard the whole event (span, log, RUM).
It consists of 2 improvements:
additionalProperties(typically exists in theusrdata and in the top-level event context) won't break the serialization of the parent event. Instead, if some particular item failed serialization, it will be dropped and serialization will continue. Both key and value will be dropped, this is a consistent behavior with drop of the reserved/non-conformant attributes.RumMonitorat the call site. This is to preventConcurrentModificationExceptionwhich sometimes happen when we iterate over them later. Making a copy at the call-site has a benefit of doing it on the user-thread, which lowers the chance that concurrent modification is done at the same time, and if there is such case, exception will be thrown on the user thread and will be more visible.Both improvements operate only on the top-level items and don't go deep, this is enough to bring the necessary safety.
Review checklist (to be filled by reviewers)