Skip to content

Commit

Permalink
feat: Inline contexts for all evaluation events
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 committed Jan 11, 2024
1 parent 539a821 commit e2e8cb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions contract-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
],
})
}
Expand Down
13 changes: 7 additions & 6 deletions launchdarkly-server-sdk/src/events/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) => {
Expand Down

0 comments on commit e2e8cb9

Please sign in to comment.