Skip to content

Commit 69d494d

Browse files
authored
fix(trace): Missing occurrence data (#93849)
- Fixes SENTRY-3ZKW - Still not sure why this is happening adding a tag for what the occurrence data looks like when its empty so i can debug further - But for now this switches the key access to a get so we skip over this gracefully
1 parent 5a54b57 commit 69d494d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/sentry/api/endpoints/organization_trace.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,13 @@ def query_trace_data(self, snuba_params: SnubaParams, trace_id: str) -> list[Ser
288288
id_to_span = {event["id"]: event for event in spans_data}
289289
id_to_error = {event["trace.span"]: event for event in errors_data}
290290
id_to_occurrence = defaultdict(list)
291-
for event in occurrence_data:
292-
for span_id in event["occurrence"].evidence_data["offender_span_ids"]:
293-
id_to_occurrence[span_id].append(event)
291+
with sentry_sdk.start_span(op="process.occurrence_data") as sdk_span:
292+
for event in occurrence_data:
293+
offender_span_ids = event["occurrence"].evidence_data.get("offender_span_ids", [])
294+
if len(offender_span_ids) == 0:
295+
sdk_span.set_data("evidence_data.empty", event["occurrence"].evidence_data)
296+
for span_id in offender_span_ids:
297+
id_to_occurrence[span_id].append(event)
294298
for span in spans_data:
295299
if span["parent_span"] in id_to_span:
296300
parent = id_to_span[span["parent_span"]]

0 commit comments

Comments
 (0)