Skip to content

Commit e650814

Browse files
committed
feat(replays): add replay events itemtype
1 parent b910e80 commit e650814

File tree

16 files changed

+3093
-7
lines changed

16 files changed

+3093
-7
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
- Add sampling + tagging by event platform and transaction op. Some (unused) tagging rules from 22.4.0 have been renamed. ([#1231](https://github.com/getsentry/relay/pull/1231))
1313
- Add ReplayRecording ItemType. ([#1236](https://github.com/getsentry/relay/pull/1236))
14+
- Add ReplayEvent ItemType. ([#1239](https://github.com/getsentry/relay/pull/1239))
1415

1516
## 22.4.0
1617

relay-common/src/constants.rs

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub enum EventType {
3636
ExpectStaple,
3737
/// Performance monitoring transactions carrying spans.
3838
Transaction,
39+
/// Replay Events for session replays
40+
ReplayEvent,
3941
/// All events that do not qualify as any other type.
4042
#[serde(other)]
4143
Default,
@@ -86,6 +88,7 @@ impl fmt::Display for EventType {
8688
EventType::ExpectCt => write!(f, "expectct"),
8789
EventType::ExpectStaple => write!(f, "expectstaple"),
8890
EventType::Transaction => write!(f, "transaction"),
91+
EventType::ReplayEvent => write!(f, "replay_event"),
8992
}
9093
}
9194
}
@@ -109,6 +112,8 @@ pub enum DataCategory {
109112
Session = 5,
110113
/// Reserved data category that shall not appear in the outcomes.
111114
Internal = -2,
115+
/// Replay Events
116+
ReplayEvent = 6,
112117
/// Any other data category not known by this Relay.
113118
#[serde(other)]
114119
Unknown = -1,
@@ -125,6 +130,7 @@ impl DataCategory {
125130
"attachment" => Self::Attachment,
126131
"session" => Self::Session,
127132
"internal" => Self::Internal,
133+
"replay_event" => Self::ReplayEvent,
128134
_ => Self::Unknown,
129135
}
130136
}
@@ -139,6 +145,7 @@ impl DataCategory {
139145
Self::Attachment => "attachment",
140146
Self::Session => "session",
141147
Self::Internal => "internal",
148+
Self::ReplayEvent => "replay_event",
142149
Self::Unknown => "unknown",
143150
}
144151
}
@@ -175,6 +182,7 @@ impl From<EventType> for DataCategory {
175182
match ty {
176183
EventType::Default | EventType::Error => Self::Error,
177184
EventType::Transaction => Self::Transaction,
185+
EventType::ReplayEvent => Self::ReplayEvent,
178186
EventType::Csp | EventType::Hpkp | EventType::ExpectCt | EventType::ExpectStaple => {
179187
Self::Security
180188
}

relay-config/src/config.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,10 @@ pub enum KafkaTopic {
767767
Metrics,
768768
/// Profiles
769769
Profiles,
770-
/// ReplayRecordings, large blobs sent by the replay sdk
770+
/// ReplayRecordings, large blobs
771771
ReplayRecordings,
772+
/// ReplayEvents, breadcrumb + session updates for replays
773+
ReplayEvents,
772774
}
773775

774776
/// Configuration for topics.
@@ -793,6 +795,8 @@ pub struct TopicAssignments {
793795
pub profiles: TopicAssignment,
794796
/// Recordings topic name.
795797
pub replay_recordings: TopicAssignment,
798+
/// Replay Events topic name.
799+
pub replay_events: TopicAssignment,
796800
}
797801

798802
impl TopicAssignments {
@@ -808,6 +812,7 @@ impl TopicAssignments {
808812
KafkaTopic::Metrics => &self.metrics,
809813
KafkaTopic::Profiles => &self.profiles,
810814
KafkaTopic::ReplayRecordings => &self.replay_recordings,
815+
KafkaTopic::ReplayEvents => &self.replay_events,
811816
}
812817
}
813818
}
@@ -824,6 +829,7 @@ impl Default for TopicAssignments {
824829
metrics: "ingest-metrics".to_owned().into(),
825830
profiles: "profiles".to_owned().into(),
826831
replay_recordings: "ingest-replay-recordings".to_owned().into(),
832+
replay_events: "ingest-replay-events".to_owned().into(),
827833
}
828834
}
829835
}

relay-general/src/store/normalize.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ impl<'a> NormalizeProcessor<'a> {
114114

115115
/// Ensure measurements interface is only present for transaction events
116116
fn normalize_measurements(&self, event: &mut Event) {
117-
if event.ty.value() != Some(&EventType::Transaction) {
117+
if event.ty.value() != Some(&EventType::Transaction)
118+
&& event.ty.value() != Some(&EventType::ReplayEvent)
119+
{
118120
// Only transaction events may have a measurements interface
119121
event.measurements = Annotated::empty();
120122
}
@@ -129,7 +131,9 @@ impl<'a> NormalizeProcessor<'a> {
129131
}
130132

131133
fn normalize_spans(&self, event: &mut Event) {
132-
if event.ty.value() == Some(&EventType::Transaction) {
134+
if event.ty.value() == Some(&EventType::Transaction)
135+
|| event.ty.value() == Some(&EventType::ReplayEvent)
136+
{
133137
spans::normalize_spans(event, &self.config.span_attributes);
134138
}
135139
}
@@ -260,6 +264,9 @@ impl<'a> NormalizeProcessor<'a> {
260264
if event.ty.value() == Some(&EventType::Transaction) {
261265
return EventType::Transaction;
262266
}
267+
if event.ty.value() == Some(&EventType::ReplayEvent) {
268+
return EventType::ReplayEvent;
269+
}
263270

264271
// The SDKs do not describe event types, and we must infer them from available attributes.
265272
let has_exceptions = event

0 commit comments

Comments
 (0)