Skip to content
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

🐛 ♻️ [RUMF 1470] Fix serialization issues #1971

Merged
merged 12 commits into from
Mar 27, 2023

Conversation

yannickadam
Copy link
Contributor

Motivation

We sometimes experience issues while serializing user-provided data:

  • Containing Cyclic References
  • Containing unserializable types (BigInt)
  • Large objects over the maximum event size, preventing data from being sent
  • Faulty toJSON functions

Changes

This PR introduces a function named sanitize that is meant to be called each time user-provided data is ingested.
In it's current form, it should be minimally invasive to be merged into a minor release.
Later - We can introduce better/more relevant serialization for specific types which will introduce breaking changes.

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@yannickadam yannickadam force-pushed the yannick.adam/rumf-1470-serialization-issues branch from c48716a to bbda59d Compare January 25, 2023 21:37
@codecov-commenter
Copy link

codecov-commenter commented Jan 25, 2023

Codecov Report

Merging #1971 (d84f9ae) into main (f6eb48d) will increase coverage by 0.01%.
The diff coverage is 98.00%.

@@            Coverage Diff             @@
##             main    #1971      +/-   ##
==========================================
+ Coverage   93.50%   93.51%   +0.01%     
==========================================
  Files         159      160       +1     
  Lines        5496     5586      +90     
  Branches     1254     1293      +39     
==========================================
+ Hits         5139     5224      +85     
- Misses        357      362       +5     
Impacted Files Coverage Δ
packages/logs/src/domain/logger.ts 92.68% <75.00%> (-2.06%) ⬇️
packages/rum-core/src/boot/rumPublicApi.ts 92.47% <88.88%> (-0.56%) ⬇️
...kages/core/src/domain/console/consoleObservable.ts 100.00% <100.00%> (ø)
packages/core/src/tools/contextManager.ts 100.00% <100.00%> (ø)
packages/core/src/tools/error.ts 94.00% <100.00%> (+0.12%) ⬆️
packages/core/src/tools/limitModification.ts 100.00% <100.00%> (ø)
packages/core/src/tools/sanitize.ts 100.00% <100.00%> (ø)
packages/core/src/tools/utils.ts 82.21% <100.00%> (ø)
packages/logs/src/boot/logsPublicApi.ts 100.00% <100.00%> (ø)
...rum-core/src/domain/contexts/featureFlagContext.ts 92.30% <100.00%> (ø)

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@yannickadam yannickadam force-pushed the yannick.adam/rumf-1470-serialization-issues branch 9 times, most recently from a422583 to 317c169 Compare February 1, 2023 15:11
@yannickadam yannickadam force-pushed the yannick.adam/rumf-1470-serialization-issues branch from 317c169 to 28dd61b Compare February 2, 2023 16:53
@yannickadam yannickadam marked this pull request as ready for review February 3, 2023 13:58
@yannickadam yannickadam requested a review from a team as a code owner February 3, 2023 13:58
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/logs/src/domain/logger.ts Outdated Show resolved Hide resolved
packages/logs/src/domain/logger.ts Outdated Show resolved Hide resolved
packages/rum-core/src/boot/rumPublicApi.ts Show resolved Hide resolved
packages/core/src/tools/limitModification.ts Outdated Show resolved Hide resolved
@yannickadam yannickadam force-pushed the yannick.adam/rumf-1470-serialization-issues branch from f37c1f2 to d3c0cba Compare February 24, 2023 09:28
@yannickadam yannickadam force-pushed the yannick.adam/rumf-1470-serialization-issues branch from d3c0cba to 7d05660 Compare February 24, 2023 09:54
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/domain/console/consoleObservable.ts Outdated Show resolved Hide resolved
packages/logs/src/boot/logsPublicApi.ts Outdated Show resolved Hide resolved
packages/logs/src/domain/logger.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.spec.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.spec.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
packages/core/src/tools/sanitize.ts Outdated Show resolved Hide resolved
@yannickadam yannickadam force-pushed the yannick.adam/rumf-1470-serialization-issues branch from 0e70d96 to d84f9ae Compare March 23, 2023 09:24
@yannickadam yannickadam merged commit 0774bb3 into main Mar 27, 2023
@yannickadam yannickadam deleted the yannick.adam/rumf-1470-serialization-issues branch March 27, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants