Skip to content

Commit

Permalink
fix(tracing): Correct discarded transaction debug message
Browse files Browse the repository at this point in the history
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
  • Loading branch information
szokeasaurusrex committed Apr 25, 2024
1 parent 6992f64 commit 588f27a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,13 @@ def finish(self, hub=None, end_timestamp=None):
return None

if self._span_recorder is None:
logger.debug("Discarding transaction because sampled = False")
# Explicit check against False needed because self.sampled might be None
if self.sampled is False:
logger.debug("Discarding transaction because sampled = False")
else:
logger.debug(
"Discarding transaction because it was not started with sentry_sdk.start_transaction"
)

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

0 comments on commit 588f27a

Please sign in to comment.