Skip to content

Commit

Permalink
Rename item type since we already have the notion of stack traces
Browse files Browse the repository at this point in the history
  • Loading branch information
phacops committed Feb 21, 2022
1 parent 2d24d01 commit 4f41d69
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Internal**:

- Spread out metric aggregation over the aggregation window to avoid concentrated waves of metrics requests to the upstream every 10 seconds. Relay now applies jitter to `initial_delay` to spread out requests more evenly over time. ([#1185](https://github.com/getsentry/relay/pull/1185))
- Add a `Profile` `ItemType` to represent the profiling data sent from Sentry SDKs. ([#1179](https://github.com/getsentry/relay/pull/1179))

## 22.2.0

Expand All @@ -16,7 +17,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**:

Expand Down
10 changes: 5 additions & 5 deletions relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,8 @@ pub enum KafkaTopic {
ProfilingSessions,
/// Profiling traces
ProfilingTraces,
/// Stacktraces
Stacktraces,
/// Profiles
Profiles,
}

/// Configuration for topics.
Expand All @@ -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 {
Expand All @@ -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,
}
}
}
Expand All @@ -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(),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions relay-server/src/actors/envelopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1254,7 +1254,7 @@ impl EnvelopeProcessor {
ItemType::ClientReport => false,
ItemType::ProfilingSession => false,
ItemType::ProfilingTrace => false,
ItemType::Stacktrace => false,
ItemType::Profile => false,
}
}

Expand Down
23 changes: 12 additions & 11 deletions relay-server/src/actors/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct Producers {
metrics: Producer,
profiling_sessions: Producer,
profiling_traces: Producer,
stacktraces: Producer,
profiles: Producer,
}

impl Producers {
Expand All @@ -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),
}
}
}
Expand Down Expand Up @@ -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 })
Expand Down Expand Up @@ -468,7 +468,7 @@ impl StoreForwarder {
Ok(())
}

fn produce_stacktrace(
fn produce_profile(
&self,
organization_id: u64,
project_id: ProjectId,
Expand All @@ -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(())
}
Expand Down Expand Up @@ -673,7 +673,7 @@ enum KafkaMessage {
Metric(MetricKafkaMessage),
ProfilingSession(ProfilingKafkaMessage),
ProfilingTrace(ProfilingKafkaMessage),
Stacktrace(ProfilingKafkaMessage),
Profile(ProfilingKafkaMessage),
}

impl KafkaMessage {
Expand All @@ -687,6 +687,7 @@ impl KafkaMessage {
KafkaMessage::Metric(_) => "metric",
KafkaMessage::ProfilingSession(_) => "profiling_session",
KafkaMessage::ProfilingTrace(_) => "profiling_trace",
KafkaMessage::Profile(_) => "profile",
}
}

Expand All @@ -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() {
Expand Down Expand Up @@ -820,8 +821,8 @@ impl Handler<StoreEnvelope> 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)?
}
_ => {}
}
Expand Down
10 changes: 5 additions & 5 deletions relay-server/src/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"),
}
}
}
Expand Down Expand Up @@ -588,7 +588,7 @@ impl Item {
| ItemType::ClientReport
| ItemType::ProfilingSession
| ItemType::ProfilingTrace
| ItemType::Stacktrace => false,
| ItemType::Profile => false,
}
}

Expand All @@ -612,7 +612,7 @@ impl Item {
ItemType::ClientReport => false,
ItemType::ProfilingSession => false,
ItemType::ProfilingTrace => false,
ItemType::Stacktrace => false,
ItemType::Profile => false,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/utils/rate_limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn infer_event_category(item: &Item) -> Option<DataCategory> {
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
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/utils/sizes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4f41d69

Please sign in to comment.