Repository navigation
feat: Add an option to compress event payloads with gzip - #414
Open
abelonogov-ld wants to merge 3 commits into
Open
abelonogov-ld wants to merge 3 commits into
abelonogov-ld wants to merge 3 commits into
Conversation
Adds EventProcessorBuilder.enableCompression(boolean), defaulting to true, and passes it to the event sender in place of the hardcoded false, so analytics and diagnostic event payloads are sent gzip-encoded. Applications sending events through a relay proxy that does not accept gzip-encoded payloads can set it to false. Matches LDConfig.enableCompression in the iOS SDK. The contract test service now declares event-gzip and optional-event-gzip and applies enableGzip from the harness. Co-authored-by: Cursor <cursoragent@cursor.com>
Older Relay Proxy versions do not accept gzip-encoded event payloads, so enableCompression is opt-in, matching iOS. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
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.
Requirements
Related issues
The Android counterpart of launchdarkly/ios-client-sdk#543. Matches iOS's
LDConfig.enableCompression, which is opt-in.Describe the solution you've provided
Adds an opt-in setting to send event payloads gzip-encoded. Compression itself is java-sdk-internal's:
DefaultEventSenderalready gzips analytics and diagnostic payloads and setsContent-Encoding: gzipwhen asked to, andComponentsImplwas passing a hardcodedfalse.EventProcessorBuilder.enableCompression(boolean), defaultfalse, named after iOS'sLDConfig.enableCompression. Off by default because older Relay Proxy versions do not accept gzip-encoded event payloads, so existing applications see no change.ComponentsImplpasses it toDefaultEventSender.EventCompressionTest: a default event processor sends plain JSON with noContent-Encoding; with compression enabled it sendsContent-Encoding: gzipand no plain JSON.LDClientEventTestreads gzip-encoded bodies when present.event-gzipandoptional-event-gzip, as iOS does, and appliesenableGzipfrom the harness.Describe alternatives you've considered
Turning compression on by default. The client SDK cannot tell whether its events URL is a Relay Proxy, or which version, so a default of
truewould break applications sending events through an older Relay Proxy on upgrade.Additional context
The diagnostic configuration payload is unchanged; it does not report this setting.
Verified:
EventCompressionTest, 2 tests, 0 failures; instrumented tests compile.