Skip to content

Commit dcce855

Browse files
simplify logic
1 parent a48d701 commit dcce855

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

sentry_sdk/client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,8 @@ def capture_event(
10831083
event_id = event.get("event_id")
10841084
if event_id is None:
10851085
event["event_id"] = event_id = uuid.uuid4().hex
1086+
1087+
span_recorder_has_gen_ai_span = event.pop("_has_gen_ai_span", False)
10861088
event_opt = self._prepare_event(event, hint, scope)
10871089
if event_opt is None:
10881090
return None
@@ -1121,10 +1123,6 @@ def capture_event(
11211123
if is_transaction and isinstance(profile, Profile):
11221124
envelope.add_profile(profile.to_json(event_opt, self.options))
11231125

1124-
span_recorder_has_gen_ai_span = event.pop("_has_gen_ai_span", False)
1125-
if "_has_gen_ai_span" in event_opt:
1126-
del event_opt["_has_gen_ai_span"]
1127-
11281126
if is_transaction and not span_recorder_has_gen_ai_span:
11291127
envelope.add_transaction(event_opt)
11301128
elif is_transaction:

0 commit comments

Comments
 (0)