Skip to content

Commit 5aa7c9b

Browse files
fix(tracing): Correct discarded transaction debug message
Transactions that are discarded because `_span_recorder` is `None` can also be discarded because they were not started with `sentry_sdk.start_transaction`. This change updates the debug message accordingly. Fixes GH-3000
1 parent bda9deb commit 5aa7c9b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sentry_sdk/tracing.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,13 @@ def finish(self, hub=None, end_timestamp=None):
748748
return None
749749

750750
if self._span_recorder is None:
751-
logger.debug("Discarding transaction because sampled = False")
751+
# Explicit check against False needed because self.sampled might be None
752+
if self.sampled is False:
753+
logger.debug("Discarding transaction because sampled = False")
754+
else:
755+
logger.debug(
756+
"Discarding transaction because it was not started with sentry_sdk.start_transaction"
757+
)
752758

753759
# This is not entirely accurate because discards here are not
754760
# exclusively based on sample rate but also traces sampler, but

0 commit comments

Comments
 (0)