From e9bac93ec1676843d969eb3a1807db8632ef2b19 Mon Sep 17 00:00:00 2001 From: Pierre Massat Date: Fri, 18 Feb 2022 09:11:09 -0500 Subject: [PATCH] Rename item type since we already have the notion of stack traces --- CHANGELOG.md | 7 ++++++- relay-config/src/config.rs | 10 +++++----- relay-server/src/actors/envelopes.rs | 4 ++-- relay-server/src/actors/store.rs | 23 ++++++++++++----------- relay-server/src/envelope.rs | 10 +++++----- relay-server/src/utils/rate_limits.rs | 2 +- relay-server/src/utils/sizes.rs | 2 +- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bda55d47953..6ced8523f50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +**Internal**: + +- Add a `Profile` `ItemType` to represent the profiling data sent from Sentry SDKs. ([#1179](https://github.com/getsentry/relay/pull/1179)) + ## 22.2.0 **Features**: @@ -10,7 +16,6 @@ - Add an option to dispatch billing outcomes to a dedicated topic. ([#1168](https://github.com/getsentry/relay/pull/1168)) - Add new `ItemType` to handle profiling data from Specto SDKs. ([#1170](https://github.com/getsentry/relay/pull/1170)) -- Add a `Stacktrace` `ItemType` to represent the stack traces sent from Sentry SDKs. ([#1179](https://github.com/getsentry/relay/pull/1179)) **Bug Fixes**: diff --git a/relay-config/src/config.rs b/relay-config/src/config.rs index a9d227b38ee..b9026518d23 100644 --- a/relay-config/src/config.rs +++ b/relay-config/src/config.rs @@ -766,8 +766,8 @@ pub enum KafkaTopic { ProfilingSessions, /// Profiling traces ProfilingTraces, - /// Stacktraces - Stacktraces, + /// Profiles + Profiles, } /// Configuration for topics. @@ -793,7 +793,7 @@ pub struct TopicAssignments { /// Profiling traces topic name pub profiling_traces: TopicAssignment, /// Stacktrace topic name - pub stacktraces: TopicAssignment, + pub profiles: TopicAssignment, } impl TopicAssignments { @@ -809,7 +809,7 @@ impl TopicAssignments { KafkaTopic::Metrics => &self.metrics, KafkaTopic::ProfilingSessions => &self.profiling_sessions, KafkaTopic::ProfilingTraces => &self.profiling_traces, - KafkaTopic::Stacktraces => &self.stacktraces, + KafkaTopic::Profiles => &self.profiles, } } } @@ -826,7 +826,7 @@ impl Default for TopicAssignments { metrics: "ingest-metrics".to_owned().into(), profiling_sessions: "profiling-sessions".to_owned().into(), profiling_traces: "profiling-traces".to_owned().into(), - stacktraces: "stacktraces".to_owned().into(), + profiles: "profiles".to_owned().into(), } } } diff --git a/relay-server/src/actors/envelopes.rs b/relay-server/src/actors/envelopes.rs index 847d9aae873..ad28f73d8b8 100644 --- a/relay-server/src/actors/envelopes.rs +++ b/relay-server/src/actors/envelopes.rs @@ -941,7 +941,7 @@ impl EnvelopeProcessor { let profiling_enabled = state.project_state.has_feature(Feature::Profiling); state.envelope.retain_items(|item| { match item.ty() { - ItemType::ProfilingSession | ItemType::ProfilingTrace | ItemType::Stacktrace => { + ItemType::ProfilingSession | ItemType::ProfilingTrace | ItemType::Profile => { profiling_enabled } _ => true, // Keep all other item types @@ -1254,7 +1254,7 @@ impl EnvelopeProcessor { ItemType::ClientReport => false, ItemType::ProfilingSession => false, ItemType::ProfilingTrace => false, - ItemType::Stacktrace => false, + ItemType::Profile => false, } } diff --git a/relay-server/src/actors/store.rs b/relay-server/src/actors/store.rs index bba97669954..43b79da8335 100644 --- a/relay-server/src/actors/store.rs +++ b/relay-server/src/actors/store.rs @@ -60,7 +60,7 @@ struct Producers { metrics: Producer, profiling_sessions: Producer, profiling_traces: Producer, - stacktraces: Producer, + profiles: Producer, } impl Producers { @@ -79,7 +79,7 @@ impl Producers { KafkaTopic::Metrics => Some(&self.metrics), KafkaTopic::ProfilingSessions => Some(&self.profiling_sessions), KafkaTopic::ProfilingTraces => Some(&self.profiling_traces), - KafkaTopic::Stacktraces => Some(&self.stacktraces), + KafkaTopic::Profiles => Some(&self.profiles), } } } @@ -146,7 +146,7 @@ impl StoreForwarder { &mut reused_producers, KafkaTopic::ProfilingTraces, )?, - stacktraces: make_producer(&*config, &mut reused_producers, KafkaTopic::Stacktraces)?, + profiles: make_producer(&*config, &mut reused_producers, KafkaTopic::Profiles)?, }; Ok(Self { config, producers }) @@ -468,7 +468,7 @@ impl StoreForwarder { Ok(()) } - fn produce_stacktrace( + fn produce_profile( &self, organization_id: u64, project_id: ProjectId, @@ -479,11 +479,11 @@ impl StoreForwarder { project_id, payload: item.payload(), }; - relay_log::trace!("Sending stacktrace to kafka"); - self.produce(KafkaTopic::Stacktraces, KafkaMessage::Stacktrace(message))?; + relay_log::trace!("Sending profile to Kafka"); + self.produce(KafkaTopic::Profiles, KafkaMessage::Profile(message))?; metric!( counter(RelayCounters::ProcessingMessageProduced) += 1, - event_type = "stacktrace" + event_type = "profile" ); Ok(()) } @@ -673,7 +673,7 @@ enum KafkaMessage { Metric(MetricKafkaMessage), ProfilingSession(ProfilingKafkaMessage), ProfilingTrace(ProfilingKafkaMessage), - Stacktrace(ProfilingKafkaMessage), + Profile(ProfilingKafkaMessage), } impl KafkaMessage { @@ -687,6 +687,7 @@ impl KafkaMessage { KafkaMessage::Metric(_) => "metric", KafkaMessage::ProfilingSession(_) => "profiling_session", KafkaMessage::ProfilingTrace(_) => "profiling_trace", + KafkaMessage::Profile(_) => "profile", } } @@ -701,7 +702,7 @@ impl KafkaMessage { Self::Metric(_message) => Uuid::nil(), // TODO(ja): Determine a partitioning key Self::ProfilingTrace(_message) => Uuid::nil(), Self::ProfilingSession(_message) => Uuid::nil(), - Self::Stacktrace(_message) => Uuid::nil(), + Self::Profile(_message) => Uuid::nil(), }; if uuid.is_nil() { @@ -820,8 +821,8 @@ impl Handler for StoreForwarder { scoping.project_id, item, )?, - ItemType::Stacktrace => { - self.produce_stacktrace(scoping.organization_id, scoping.project_id, item)? + ItemType::Profile => { + self.produce_profile(scoping.organization_id, scoping.project_id, item)? } _ => {} } diff --git a/relay-server/src/envelope.rs b/relay-server/src/envelope.rs index 16a3bd5f5ae..5fe744245a2 100644 --- a/relay-server/src/envelope.rs +++ b/relay-server/src/envelope.rs @@ -106,8 +106,8 @@ pub enum ItemType { ProfilingSession, /// Profiling data ProfilingTrace, - /// Stacktrace event payload encoded in JSON - Stacktrace, + /// Profile event payload encoded in JSON + Profile, } impl ItemType { @@ -141,7 +141,7 @@ impl fmt::Display for ItemType { Self::ClientReport => write!(f, "client report"), Self::ProfilingSession => write!(f, "profiling session"), Self::ProfilingTrace => write!(f, "profiling trace"), - Self::Stacktrace => write!(f, "stacktrace"), + Self::Profile => write!(f, "profile"), } } } @@ -588,7 +588,7 @@ impl Item { | ItemType::ClientReport | ItemType::ProfilingSession | ItemType::ProfilingTrace - | ItemType::Stacktrace => false, + | ItemType::Profile => false, } } @@ -612,7 +612,7 @@ impl Item { ItemType::ClientReport => false, ItemType::ProfilingSession => false, ItemType::ProfilingTrace => false, - ItemType::Stacktrace => false, + ItemType::Profile => false, } } } diff --git a/relay-server/src/utils/rate_limits.rs b/relay-server/src/utils/rate_limits.rs index f1cd4b547d8..05272868b6e 100644 --- a/relay-server/src/utils/rate_limits.rs +++ b/relay-server/src/utils/rate_limits.rs @@ -105,7 +105,7 @@ fn infer_event_category(item: &Item) -> Option { ItemType::UserReport => None, ItemType::ProfilingSession => None, ItemType::ProfilingTrace => None, - ItemType::Stacktrace => None, + ItemType::Profile => None, // the following items are "internal" item types. From the perspective of the SDK // the use the "internal" data category however this data category is in fact never // supposed to be emitted by relay as internal items must not be rate limited. As diff --git a/relay-server/src/utils/sizes.rs b/relay-server/src/utils/sizes.rs index a2dc2f262ff..8dd8eb46ddd 100644 --- a/relay-server/src/utils/sizes.rs +++ b/relay-server/src/utils/sizes.rs @@ -29,7 +29,7 @@ pub fn check_envelope_size_limits(config: &Config, envelope: &Envelope) -> bool | ItemType::FormData | ItemType::ProfilingSession | ItemType::ProfilingTrace - | ItemType::Stacktrace => event_size += item.len(), + | ItemType::Profile => event_size += item.len(), ItemType::Attachment | ItemType::UnrealReport => { if item.len() > config.max_attachment_size() { return false;