Skip to content

Commit

Permalink
fix(server): Update envelope without touching event
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbayer committed Aug 4, 2023
1 parent 9375cba commit 13d9953
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion relay-server/src/actors/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2364,8 +2364,10 @@ impl EnvelopeProcessorService {
ItemAction::Drop(outcome.clone())
}
});
state.managed_envelope.update_freeze_event();
if state.managed_envelope.envelope().is_empty() {
// Just for bookkeeping.
// Call reject to make sure that outcomes are generated for the transaction event,
// which has already been removed from the envelope for processing.
state.managed_envelope.reject(outcome);
}

Expand Down
15 changes: 15 additions & 0 deletions relay-server/src/utils/managed_envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,21 @@ impl ManagedEnvelope {
self
}

/// Update the context with envelope information, leaving event information untouched.
///
/// This is useful when the event has already been removed from the envelope for processing,
/// but we still want outcomes to be generated for the event.
pub fn update_freeze_event(&mut self) -> &mut Self {
let event_category = self.context.summary.event_category;
let event_metrics_extracted = self.context.summary.event_metrics_extracted;

self.context.summary = EnvelopeSummary::compute(self.envelope());

self.context.summary.event_category = event_category;
self.context.summary.event_metrics_extracted = event_metrics_extracted;
self
}

/// Retains or drops items based on the [`ItemAction`].
///
///
Expand Down

0 comments on commit 13d9953

Please sign in to comment.