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
Enable tracing without performance by default (#4240)
Changing the default of `traces_sample_rate` to `0`. This means incoming
traces will be continued, but we will not start traces on our own. (It
used to be set to: never start or continue traces by default)
Refs #4102
Copy file name to clipboardExpand all lines: MIGRATION_GUIDE.md
+1
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
9
9
### Changed
10
10
11
11
- The SDK now supports Python 3.7 and higher.
12
+
- The default of `traces_sample_rate` changed to `0`. Meaning: Incoming traces will be continued by default. For example, if your frontend sends a `sentry-trace/baggage` headers pair, your SDK will create Spans and send them to Sentry. (The default used to be `None` meaning by default no Spans where created, no matter what headers the frontend sent to your project.) See also: https://docs.sentry.io/platforms/python/configuration/options/#traces_sample_rate
12
13
-`sentry_sdk.start_span` now only takes keyword arguments.
13
14
-`sentry_sdk.start_transaction`/`sentry_sdk.start_span` no longer takes the following arguments: `span`, `parent_sampled`, `trace_id`, `span_id` or `parent_span_id`.
14
15
- You can no longer change the sampled status of a span with `span.sampled = False` after starting it.
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