File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,10 @@ def _should_capture(
237237 scope = None , # type: Optional[Scope]
238238 ):
239239 # type: (...) -> bool
240+ if event .get ("type" ) == "transaction" :
241+ # Transactions are sampled independent of error events.
242+ return True
243+
240244 if scope is not None and not scope ._should_capture :
241245 return False
242246
Original file line number Diff line number Diff line change @@ -155,3 +155,15 @@ def test_nested_span_sampling_override():
155155 assert span .sampled is True
156156 with Hub .current .start_span (transaction = "inner" , sampled = False ) as span :
157157 assert span .sampled is False
158+
159+
160+ def test_no_double_sampling (sentry_init , capture_events ):
161+ # Transactions should not be subject to the global/error sample rate.
162+ # Only the traces_sample_rate should apply.
163+ sentry_init (traces_sample_rate = 1.0 , sample_rate = 0.0 )
164+ events = capture_events ()
165+
166+ with Hub .current .start_span (transaction = "/" ):
167+ pass
168+
169+ assert len (events ) == 1
You can’t perform that action at this time.
0 commit comments