-
Notifications
You must be signed in to change notification settings - Fork 128
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
♻️ [RUM-250] introduce a DeflateEncoder #2376
Conversation
With this change, we always follow the same codepath when adding a record to a segment. This will be useful in the next commit to adjust `addRecord` so it takes a callback parameter.
e4de259
to
2f2913b
Compare
/to-staging |
🚂 Branch Integration: starting soon, merge in < 0s commit 2f2913b48c will soon be integrated into staging-32. This build is going to start soon! (estimated merge in less than 0s) you can cancel this operation by commenting your pull request with |
🚂 Branch Integration: this commit was successfully integrated Commit 2f2913b48c has been merged into staging-32 in merge commit 3f5189748c. Check out the triggered pipeline on Gitlab 🦊 |
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
@@ -8,7 +8,8 @@ | |||
"moduleResolution": "node", | |||
"resolveJsonModule": true, | |||
"target": "ES2015", | |||
"types": ["node", "jasmine", "@wdio/globals/types", "ajv"] | |||
"types": ["node", "jasmine", "@wdio/globals/types", "ajv"], | |||
"allowJs": true |
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.
❓ question: is it needed?
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.
It is, because:
- e2e tests are importing
@datadog/browser-rum/test
packages/rum/test/index.ts
is importingmockWorker
mockWorker
now importsstring2buf
fromdeflate.js
deflate.js
is usingexport
statements which are not supported in nodejs for .js files.
So we need tsc to transpile JS files as well. Moving string2buf in a TS file could also work, but I prefered to change the TS config because we might want to keep pako sources as close to the original as possible to ease its upgrade, but this could be challenged of course.
Co-authored-by: Bastien Caudan <1331991+bcaudan@users.noreply.github.com>
Motivation
This PR introduce a higher level API for the deflate Worker. The goal is to reuse it to compress RUM and Logs data. For now, it is only used for Replay.
This PR also makes sure to leverage this new encoder object to simplify the segment collection logic.
Changes
previously, the Segment required an initial record to be instanciated. The motivation behind this was to make sure no empty Segment can be created, but it required to have two different ways to add a record. This PR changes this so the flow of adding a record is easier to follow and factorize. To make sure no Segment are flushed, a runtime assertion has been added.
move deflate-related modules in a folder to be collocated
introduce a DeflateEncoder and use it in the segmentCollection
Testing
I have gone over the contributing documentation.