From e2e8cb911222930ba07d86a939628b16df24090a Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Mon, 13 Nov 2023 16:30:19 -0500 Subject: [PATCH] feat: Inline contexts for all evaluation events --- contract-tests/src/main.rs | 1 + launchdarkly-server-sdk/src/events/dispatcher.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/contract-tests/src/main.rs b/contract-tests/src/main.rs index 5da2617..203b897 100644 --- a/contract-tests/src/main.rs +++ b/contract-tests/src/main.rs @@ -101,6 +101,7 @@ async fn status() -> impl Responder { "service-endpoints".to_string(), "context-type".to_string(), "secure-mode-hash".to_string(), + "inline-context".to_string(), ], }) } diff --git a/launchdarkly-server-sdk/src/events/dispatcher.rs b/launchdarkly-server-sdk/src/events/dispatcher.rs index e4efd5d..1973ebd 100644 --- a/launchdarkly-server-sdk/src/events/dispatcher.rs +++ b/launchdarkly-server-sdk/src/events/dispatcher.rs @@ -187,6 +187,11 @@ impl EventDispatcher { InputEvent::FeatureRequest(fre) => { self.outbox.add_to_summary(&fre); + let inlined = fre.clone().into_inline( + self.events_configuration.all_attributes_private, + self.events_configuration.private_attributes.clone(), + ); + if self.notice_context(&fre.base.context) { self.outbox.add_event(OutputEvent::Index(fre.to_index_event( self.events_configuration.all_attributes_private, @@ -202,16 +207,12 @@ impl EventDispatcher { if let Some(debug_events_until_date) = fre.debug_events_until_date { let time = u128::from(debug_events_until_date); if time > now && time > self.last_known_time { - let event = fre.clone().into_inline( - self.events_configuration.all_attributes_private, - self.events_configuration.private_attributes.clone(), - ); - self.outbox.add_event(OutputEvent::Debug(event)); + self.outbox.add_event(OutputEvent::Debug(inlined.clone())); } } if fre.track_events { - self.outbox.add_event(OutputEvent::FeatureRequest(fre)); + self.outbox.add_event(OutputEvent::FeatureRequest(inlined)); } } InputEvent::Identify(identify) => {