diff --git a/contract-tests/src/client_entity.rs b/contract-tests/src/client_entity.rs index ca457c2..fdf5908 100644 --- a/contract-tests/src/client_entity.rs +++ b/contract-tests/src/client_entity.rs @@ -130,6 +130,7 @@ impl ClientEntity { processor_builder.capacity(capacity); } processor_builder.all_attributes_private(events.all_attributes_private); + processor_builder.compress_events(false); if let Some(e) = events.enable_gzip { processor_builder.compress_events(e); } diff --git a/launchdarkly-server-sdk/Cargo.toml b/launchdarkly-server-sdk/Cargo.toml index e21934c..16168d4 100644 --- a/launchdarkly-server-sdk/Cargo.toml +++ b/launchdarkly-server-sdk/Cargo.toml @@ -14,7 +14,7 @@ exclude = [ ] [package.metadata.docs.rs] -features = ["event-compression"] +features = [] [dependencies] chrono = "0.4.19" @@ -55,7 +55,11 @@ reqwest = { version = "0.12.4", features = ["json"] } testing_logger = "0.1.1" [features] -default = ["hyper-rustls-native-roots", "crypto-aws-lc-rs"] +default = [ + "hyper-rustls-native-roots", + "crypto-aws-lc-rs", + "event-compression" +] crypto-aws-lc-rs = ["dep:aws-lc-rs"] crypto-openssl = ["dep:openssl"] diff --git a/launchdarkly-server-sdk/src/events/processor_builders.rs b/launchdarkly-server-sdk/src/events/processor_builders.rs index 714be7e..5a2440a 100644 --- a/launchdarkly-server-sdk/src/events/processor_builders.rs +++ b/launchdarkly-server-sdk/src/events/processor_builders.rs @@ -178,6 +178,9 @@ impl EventProcessorBuilder { private_attributes: HashSet::new(), omit_anonymous_contexts: false, transport: None, + #[cfg(feature = "event-compression")] + compress_events: true, + #[cfg(not(feature = "event-compression"))] compress_events: false, } } @@ -261,11 +264,10 @@ impl EventProcessorBuilder { #[cfg(feature = "event-compression")] /// Should the event payload sent to LaunchDarkly use gzip compression. By - /// default this is false to prevent backward breaking compatibility issues with - /// older versions of the relay proxy. + /// default this is true. // - /// Customers not using the relay proxy are strongly encouraged to enable this - /// feature to reduce egress bandwidth cost. + /// Customers using the relay proxy are encouraged to disable this feature to avoid unnecessary + /// CPU overhead, as the relay proxy will decompress & recompress the payloads. pub fn compress_events(&mut self, enabled: bool) -> &mut Self { self.compress_events = enabled; self