Skip to content

Commit 1e02895

Browse files
authored
fix: no longer set the last event id for transactions (#1186)
1 parent e06c9c5 commit 1e02895

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ sentry-sdk==0.10.1
2020

2121
A major release `N` implies the previous release `N-1` will no longer receive updates. We generally do not backport bugfixes to older versions unless they are security relevant. However, feel free to ask for backports of specific commits on the bugtracker.
2222

23+
## Unreleased
24+
25+
- No longer set the last event id for transactions #1186
26+
2327
## 1.3.1
2428

2529
- Fix detection of contextvars compatibility with Gevent versions >=20.9.0 #1157

sentry_sdk/hub.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ def capture_event(
318318
client, top_scope = self._stack[-1]
319319
scope = _update_scope(top_scope, scope, scope_args)
320320
if client is not None:
321+
is_transaction = event.get("type") == "transaction"
321322
rv = client.capture_event(event, hint, scope)
322-
if rv is not None:
323+
if rv is not None and not is_transaction:
323324
self._last_event_id = rv
324325
return rv
325326
return None

tests/test_basics.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ def test_event_id(sentry_init, capture_events):
7171
assert last_event_id() == event_id
7272
assert Hub.current.last_event_id() == event_id
7373

74+
new_event_id = Hub.current.capture_event({"type": "transaction"})
75+
assert new_event_id is not None
76+
assert new_event_id != event_id
77+
assert Hub.current.last_event_id() == event_id
78+
7479

7580
def test_option_callback(sentry_init, capture_events):
7681
drop_events = False

0 commit comments

Comments
 (0)