diff --git a/CHANGELOG.md b/CHANGELOG.md index 98d8667ca1..19899e0361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Spawn more threads for CPU intensive work. ([#1378](https://github.com/getsentry/relay/pull/1378)) - Add missing fields to DeviceContext ([#1383](https://github.com/getsentry/relay/pull/1383)) - Improve performance of Redis accesses by not running `PING` everytime a connection is reused. ([#1394](https://github.com/getsentry/relay/pull/1394)) +- Distinguish between various discard reasons for profiles. ([#1395](https://github.com/getsentry/relay/pull/1395)) ## 22.7.0 diff --git a/relay-profiling/src/lib.rs b/relay-profiling/src/lib.rs index 2a2c1d4e9e..1f992670e4 100644 --- a/relay-profiling/src/lib.rs +++ b/relay-profiling/src/lib.rs @@ -105,11 +105,12 @@ mod utils; use crate::android::parse_android_profile; use crate::cocoa::parse_cocoa_profile; -use crate::error::ProfileError; use crate::python::parse_python_profile; use crate::rust::parse_rust_profile; use crate::typescript::parse_typescript_profile; +pub use crate::error::ProfileError; + #[derive(Debug, Deserialize)] struct MinimalProfile { platform: String, diff --git a/relay-server/src/actors/outcome.rs b/relay-server/src/actors/outcome.rs index df6b8f6048..24a212587c 100644 --- a/relay-server/src/actors/outcome.rs +++ b/relay-server/src/actors/outcome.rs @@ -306,6 +306,10 @@ pub enum DiscardReason { /// (Relay) We failed to parse the profile so we discard the profile. ProcessProfile, + + /// (Relay) The profile is parseable but semantically invalid. This could happen if + /// profiles lack sufficient samples. + InvalidProfile, } impl DiscardReason { @@ -342,6 +346,7 @@ impl DiscardReason { DiscardReason::Internal => "internal", DiscardReason::TransactionSampled => "transaction_sampled", DiscardReason::EmptyEnvelope => "empty_envelope", + DiscardReason::InvalidProfile => "invalid_profile", } } } diff --git a/relay-server/src/actors/processor.rs b/relay-server/src/actors/processor.rs index 4dd5e26be4..4c3f67d706 100644 --- a/relay-server/src/actors/processor.rs +++ b/relay-server/src/actors/processor.rs @@ -366,6 +366,15 @@ fn outcome_from_parts(field: ClientReportField, reason: &str) -> Result Outcome { + let discard_reason = match err { + relay_profiling::ProfileError::CannotSerializePayload => DiscardReason::Internal, + relay_profiling::ProfileError::NotEnoughSamples => DiscardReason::InvalidProfile, + _ => DiscardReason::ProcessProfile, + }; + Outcome::Invalid(discard_reason) +} + /// Synchronous service for processing envelopes. pub struct EnvelopeProcessor { config: Arc, @@ -882,9 +891,9 @@ impl EnvelopeProcessor { item.set_payload(ContentType::Json, &payload[..]); return true; } - Err(_) => { + Err(err) => { context.track_outcome( - Outcome::Invalid(DiscardReason::ProcessProfile), + outcome_from_profile_error(err), DataCategory::Profile, 1, );