You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/integrations/opentelemetry/test_sampler.py
+16-12
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,16 @@
6
6
importsentry_sdk
7
7
8
8
9
+
USE_DEFAULT_TRACES_SAMPLE_RATE=-1
10
+
9
11
tracer=trace.get_tracer(__name__)
10
12
11
13
12
14
@pytest.mark.parametrize(
13
15
"traces_sample_rate, expected_num_of_envelopes",
14
16
[
15
-
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=None will be used)
16
-
(-1, 0),
17
+
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=0 will be used)
18
+
(USE_DEFAULT_TRACES_SAMPLE_RATE, 0),
17
19
# traces_sample_rate=None means do not create new traces, and also do not continue incoming traces. So, no envelopes at all.
18
20
(None, 0),
19
21
# traces_sample_rate=0 means do not create new traces (0% of the requests), but continue incoming traces. So envelopes will be created only if there is an incoming trace.
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=None will be used)
180
-
(-1, 0),
181
+
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=0 will be used)
182
+
(USE_DEFAULT_TRACES_SAMPLE_RATE, 1),
181
183
# traces_sample_rate=None means do not create new traces, and also do not continue incoming traces. So, no envelopes at all.
182
184
(None, 0),
183
185
# traces_sample_rate=0 means do not create new traces (0% of the requests), but continue incoming traces. So envelopes will be created only if there is an incoming trace.
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=None will be used)
231
-
(-1, 0, 0),
232
+
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=0 will be used)
233
+
(USE_DEFAULT_TRACES_SAMPLE_RATE, 0, 0),
234
+
(USE_DEFAULT_TRACES_SAMPLE_RATE, 1, 1),
232
235
# traces_sample_rate=None means do not create new traces, and also do not continue incoming traces. So, no envelopes at all.
236
+
(None, 0, 0),
233
237
(None, 1, 0),
234
238
# traces_sample_rate=0 means do not create new traces (0% of the requests), but continue incoming traces. So envelopes will be created only if there is an incoming trace.
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=None will be used)
285
-
(-1, 0),
288
+
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=0 will be used)
289
+
(USE_DEFAULT_TRACES_SAMPLE_RATE, 0),
286
290
# traces_sample_rate=None means do not create new traces, and also do not continue incoming traces. So, no envelopes at all.
287
291
(None, 0),
288
292
# traces_sample_rate=0 means do not create new traces (0% of the requests), but continue incoming traces. So envelopes will be created only if there is an incoming trace.
0 commit comments