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(
237
237
scope = None , # type: Optional[Scope]
238
238
):
239
239
# type: (...) -> bool
240
+ if event .get ("type" ) == "transaction" :
241
+ # Transactions are sampled independent of error events.
242
+ return True
243
+
240
244
if scope is not None and not scope ._should_capture :
241
245
return False
242
246
Original file line number Diff line number Diff line change @@ -155,3 +155,15 @@ def test_nested_span_sampling_override():
155
155
assert span .sampled is True
156
156
with Hub .current .start_span (transaction = "inner" , sampled = False ) as span :
157
157
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