Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions relay-event-normalization/src/replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ fn normalize_array_fields(replay: &mut Replay) {
if let Some(items) = replay.urls.value_mut() {
items.truncate(100);
}
if let Some(items) = replay.segment_names.value_mut() {
items.truncate(100);
}
}

fn normalize_ip_address(replay: &mut Replay, ip_address: Option<StdIpAddr>) {
Expand Down Expand Up @@ -386,10 +389,15 @@ mod tests {
.map(|_| Annotated::new(Uuid::parse_str("52df9022835246eeb317dbd739ccd059").unwrap()))
.collect();

let segment_names: Vec<Annotated<String>> = (0..101)
.map(|_| Annotated::new("/users/{id}".to_owned()))
.collect();

let mut replay = Annotated::new(Replay {
urls: Annotated::new(urls),
error_ids: Annotated::new(error_ids),
trace_ids: Annotated::new(trace_ids),
segment_names: Annotated::new(segment_names),
..Default::default()
});

Expand All @@ -399,6 +407,7 @@ mod tests {
assert!(replay_value.error_ids.value().unwrap().len() == 100);
assert!(replay_value.trace_ids.value().unwrap().len() == 100);
assert!(replay_value.urls.value().unwrap().len() == 100);
assert!(replay_value.segment_names.value().unwrap().len() == 100);
}

#[test]
Expand Down
4 changes: 4 additions & 0 deletions relay-event-schema/src/protocol/replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ pub struct Replay {
#[metastructure(max_depth = 5, max_bytes = 2048)]
pub trace_ids: Annotated<Array<Uuid>>,

/// A list of segment names discovered during the lifetime of the segment.
#[metastructure(pii = "true", max_depth = 5, max_bytes = 2048)]
pub segment_names: Annotated<Array<String>>,

/// Contexts describing the environment (e.g. device, os or browser).
#[metastructure(skip_serialization = "empty")]
pub contexts: Annotated<Contexts>,
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_replay_combined_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def test_replay_combined_with_processing(
replay_event = json.loads(combined_replay_message["replay_event"])

assert replay_event["replay_id"] == replay_id
assert replay_event["segment_names"] == [
"/api/0/organizations/",
"/api/0/projects/",
]


def test_standalone_recording_from_faulty_sdk(
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/test_replay_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def generate_replay_sdk_event(replay_id="d2132d31b39445f1938d7e21b6bf0ec4"):
"urls": ["sentry.io"],
"error_ids": [str(uuid.uuid4())],
"trace_ids": [str(uuid.uuid4())],
"segment_names": ["/api/0/organizations/", "/api/0/projects/"],
"dist": "1.12",
"platform": "javascript",
"environment": "production",
Expand Down Expand Up @@ -61,6 +62,7 @@ def assert_replay_payload_matches(produced, consumed):
assert consumed["urls"] == produced["urls"]
assert consumed["error_ids"] == produced["error_ids"]
assert consumed["trace_ids"] == produced["trace_ids"]
assert consumed["segment_names"] == produced["segment_names"]
assert consumed["dist"] == produced["dist"]
assert consumed["platform"] == produced["platform"]
assert consumed["environment"] == produced["environment"]
Expand Down
Loading