-
Notifications
You must be signed in to change notification settings - Fork 142
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-253] compress RUM data #2400
Conversation
51ca845
to
1cd7901
Compare
Current dependencies on/for this PR:
This comment was autogenerated by Freephite. |
return new Batch( | ||
createHttpRequest(configuration, endpointBuilder, configuration.batchBytesLimit, reportError), | ||
encoder || createIdentityEncoder(), |
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.
💭 thought: I had a hard time understanding in which case the encoder was undefined and I'm wondering if it could me simplified. FMU we have to look at:
- Identify that createDeflateEncoder can be undefined :
encoder: createDeflateEncoder && createDeflateEncoder(DeflateEncoderStreamId.RUM), - Because deflateWorker && createDeflateEncoder can be undefined :
browser-sdk/packages/rum-core/src/boot/rumPublicApi.ts
Lines 193 to 195 in 9862d64
deflateWorker && createDeflateEncoder && ((streamId) => createDeflateEncoder(configuration, deflateWorker!, streamId)) - Then deflateWorker can be null because of:
browser-sdk/packages/rum-core/src/boot/rumPublicApi.ts
Lines 152 to 161 in 9862d64
if ( isExperimentalFeatureEnabled(ExperimentalFeature.COMPRESS_BATCH) && !eventBridgeAvailable && startDeflateWorker ) { deflateWorker = startDeflateWorker(configuration, 'Datadog RUM') if (!deflateWorker) { return } }
Personally I prefer to have a rumPublicApi
as dump as possible and make the instantiation checks in startRum.
Also, It could be nice to create the encoder in startRum() to remove the logic from startRumBatch
and startBatchWithReplica
.
I don't know all the intricacies of the implement so it might no be feasible 🙂 Let me know what you think.
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.
As seen IRL, I changed a bit how encoders are created so the condition on whether we use an "Identity" or "Deflate" encoder is clearer.
7a494ca
to
de29ea4
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2400 +/- ##
==========================================
+ Coverage 93.26% 93.86% +0.60%
==========================================
Files 221 222 +1
Lines 6580 6459 -121
Branches 1443 1431 -12
==========================================
- Hits 6137 6063 -74
+ Misses 443 396 -47 ☔ View full report in Codecov by Sentry. |
8329f48
to
399820b
Compare
ec86af6
to
5466106
Compare
399820b
to
3a7384d
Compare
@@ -29,19 +29,21 @@ export function createDeflateEncoder( | |||
configuration, | |||
worker, | |||
'message', | |||
({ data: workerResponse }: MessageEvent<DeflateWorkerResponse>) => { | |||
if (workerResponse.type !== 'wrote' || workerResponse.streamId !== streamId) { | |||
({ data }: MessageEvent<DeflateWorkerResponse>) => { |
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: you have reverted the previous commit changes, is it intended?
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.
Ah, no, must have been a conflict resolution error.
This new interface is slightly different than the current deflate encoder implementation. This is because it has been adjusted to take the Batch constraints into account. The deflate encoder implementation will be changed in a future commit.
This commit is not pretty. To avoid having inflated packages while dogfooding, we pass some functions from rum to rum-core when creating the RUM public API. In the future, those functions will be moved to the core package, and rum-core will be able to import them directly.
e4853e1
to
ebb9a24
Compare
Motivation
To reduce the bandwidth impact when using the RUM Browser SDK, we want to compress data sent to the
backend.
Changes
This PR implement data compression for the "rum" package/bundle behind an experimental feature flag.
This will stay like this during dogfooding, then we'll introduce a proper initialization parameter +
support it on "rum-slim" and "logs" as well.
Testing
I have gone over the contributing documentation.