From 10ac11398c7232c19638a7b31aef44dbde563267 Mon Sep 17 00:00:00 2001 From: Colton Allen Date: Tue, 6 Sep 2022 13:45:57 -0500 Subject: [PATCH 1/3] Add invalid replay outcome --- relay-server/src/actors/outcome.rs | 4 ++++ relay-server/src/actors/processor.rs | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/relay-server/src/actors/outcome.rs b/relay-server/src/actors/outcome.rs index 831e524c3a..92cf4d93a8 100644 --- a/relay-server/src/actors/outcome.rs +++ b/relay-server/src/actors/outcome.rs @@ -326,6 +326,9 @@ pub enum DiscardReason { /// (Relay) The profile is parseable but semantically invalid. This could happen if /// profiles lack sufficient samples. InvalidProfile, + + // (Relay) We failed to parse the replay so we discard it. + InvalidReplay, } impl DiscardReason { @@ -363,6 +366,7 @@ impl DiscardReason { DiscardReason::TransactionSampled => "transaction_sampled", DiscardReason::EmptyEnvelope => "empty_envelope", DiscardReason::InvalidProfile => "invalid_profile", + DiscardReason::InvalidReplay => "invalid_replay", } } } diff --git a/relay-server/src/actors/processor.rs b/relay-server/src/actors/processor.rs index 136ddc14a2..4e66167030 100644 --- a/relay-server/src/actors/processor.rs +++ b/relay-server/src/actors/processor.rs @@ -886,6 +886,7 @@ impl EnvelopeProcessor { /// Remove replays if the feature flag is not enabled fn process_replays(&self, state: &mut ProcessEnvelopeState) { let replays_enabled = state.project_state.has_feature(Feature::Replays); + let context = &state.envelope_context; let envelope = &mut state.envelope; let client_addr = envelope.meta().client_addr(); @@ -903,7 +904,11 @@ impl EnvelopeProcessor { true } Err(_) => { - relay_log::debug!("Replay item could not be parsed."); + context.track_outcome( + Outcome::Invalid(DiscardReason::InvalidReplay), + DataCategory::Replay, + 1, + ); false } } From bfbbffdd7c962ac5296d879c0f744d3dc1267ef2 Mon Sep 17 00:00:00 2001 From: Colton Allen Date: Tue, 6 Sep 2022 15:25:17 -0500 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88e92d1a4b..60ca441ec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Batch metrics buckets into logical partitions before sending them as envelopes. ([#1440](https://github.com/getsentry/relay/pull/1440)) - Filter single samples in cocoa profiles and events with no duration in Android profiles. ([#1445](https://github.com/getsentry/relay/pull/1445)) - Add looser type requirements for the user.id field. ([#1443](https://github.com/getsentry/relay/pull/1443)) +- Add InvalidReplay outcome. ([#1455](https://github.com/getsentry/relay/pull/1455)) **Features**: From 1b7a1b3b048f32df300d1f34b9a0ec48aa17771b Mon Sep 17 00:00:00 2001 From: Colton Allen Date: Tue, 6 Sep 2022 15:26:25 -0500 Subject: [PATCH 3/3] Rename to InvalidReplayEvent --- CHANGELOG.md | 2 +- relay-server/src/actors/outcome.rs | 4 ++-- relay-server/src/actors/processor.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60ca441ec9..25d3234c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ - Batch metrics buckets into logical partitions before sending them as envelopes. ([#1440](https://github.com/getsentry/relay/pull/1440)) - Filter single samples in cocoa profiles and events with no duration in Android profiles. ([#1445](https://github.com/getsentry/relay/pull/1445)) - Add looser type requirements for the user.id field. ([#1443](https://github.com/getsentry/relay/pull/1443)) -- Add InvalidReplay outcome. ([#1455](https://github.com/getsentry/relay/pull/1455)) +- Add InvalidReplayEvent outcome. ([#1455](https://github.com/getsentry/relay/pull/1455)) **Features**: diff --git a/relay-server/src/actors/outcome.rs b/relay-server/src/actors/outcome.rs index 92cf4d93a8..3d166620cd 100644 --- a/relay-server/src/actors/outcome.rs +++ b/relay-server/src/actors/outcome.rs @@ -328,7 +328,7 @@ pub enum DiscardReason { InvalidProfile, // (Relay) We failed to parse the replay so we discard it. - InvalidReplay, + InvalidReplayEvent, } impl DiscardReason { @@ -366,7 +366,7 @@ impl DiscardReason { DiscardReason::TransactionSampled => "transaction_sampled", DiscardReason::EmptyEnvelope => "empty_envelope", DiscardReason::InvalidProfile => "invalid_profile", - DiscardReason::InvalidReplay => "invalid_replay", + DiscardReason::InvalidReplayEvent => "invalid_replay", } } } diff --git a/relay-server/src/actors/processor.rs b/relay-server/src/actors/processor.rs index 4e66167030..a404dd64f5 100644 --- a/relay-server/src/actors/processor.rs +++ b/relay-server/src/actors/processor.rs @@ -905,7 +905,7 @@ impl EnvelopeProcessor { } Err(_) => { context.track_outcome( - Outcome::Invalid(DiscardReason::InvalidReplay), + Outcome::Invalid(DiscardReason::InvalidReplayEvent), DataCategory::Replay, 1, );