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
The migration guide was slowly becoming unreadable. It doesn't have to
be as digestible as the migration guide in the docs, but it still
shouldn't completely suck.
Divide stuff into subsections and rephrase/expand on some points.
Copy file name to clipboardExpand all lines: MIGRATION_GUIDE.md
+86-40Lines changed: 86 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,28 +10,41 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
10
10
11
11
### Changed
12
12
13
+
#### General
14
+
13
15
- The SDK now supports Python 3.7 and higher.
14
-
- 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
15
16
- Tag values on event dictionaries, which are passed to `before_send` and `before_send_transaction`, now are always `str` values. Previously, despite tag values being typed as `str`, they often had different values. Therefore, if you have configured any `before_send` and `before_send_transaction` functions which perform some logic based on tag values, you need to check and if needed update those functions to correctly handle `str` values.
17
+
18
+
#### Error Capturing
19
+
20
+
- We updated how we handle `ExceptionGroup`s. You will now get more data if `ExceptionGroup`s are appearing in chained exceptions. It could happen that after updating the SDK the grouping of issues change because of this. So eventually you will see the same exception in two Sentry issues (one from before the update, one from after the update).
21
+
22
+
#### Tracing
23
+
24
+
- 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
16
25
-`sentry_sdk.start_span` now only takes keyword arguments.
17
26
-`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`.
18
-
- You can no longer change the sampled status of a span with `span.sampled = False` after starting it.
27
+
-`sentry_sdk.continue_trace` no longer returns a `Transaction` and is now a context manager.
28
+
- You can no longer change the sampled status of a span with `span.sampled = False` after starting it. The sampling decision needs to be either be made in the `traces_sampler`, or you need to pass an explicit `sampled` parameter to `start_span`.
19
29
- The `Span()` constructor does not accept a `hub` parameter anymore.
20
-
- The `sentry_sdk.Scope()` constructor no longer accepts a `client` parameter.
21
30
-`Span.finish()` does not accept a `hub` parameter anymore.
22
-
-`Span.finish()` no longer returns the `event_id` if the event is sent to sentry.
31
+
-`Span.finish()` no longer returns the `event_id` if the event is sent to Sentry.
32
+
- The `sampling_context` argument of `traces_sampler` now additionally contains all span attributes known at span start.
33
+
- The `SentrySpanProcessor` and `SentryPropagator` are exported from `sentry_sdk.opentelemetry` instead of `sentry_sdk.integrations.opentelemetry`.
34
+
35
+
#### Profiling
36
+
37
+
- The `sampling_context` argument of `profiles_sampler` now additionally contains all span attributes known at span start.
23
38
- The `Profile()` constructor does not accept a `hub` parameter anymore.
24
39
- A `Profile` object does not have a `.hub` property anymore.
25
40
-`MAX_PROFILE_DURATION_NS`, `PROFILE_MINIMUM_SAMPLES`, `Profile`, `Scheduler`, `ThreadScheduler`, `GeventScheduler`, `has_profiling_enabled`, `setup_profiler`, `teardown_profiler` are no longer accessible from `sentry_sdk.profiler`. They're still accessible from `sentry_sdk.profiler.transaction_profiler`.
26
41
-`DEFAULT_SAMPLING_FREQUENCY`, `MAX_STACK_DEPTH`, `get_frame_name`, `extract_frame`, `extract_stack`, `frame_id` are no longer accessible from `sentry_sdk.profiler`. They're still accessible from `sentry_sdk.profiler.utils`.
27
-
-`sentry_sdk.continue_trace` no longer returns a `Transaction` and is now a context manager.
28
-
- Redis integration: In Redis pipeline spans there is no `span["data"]["redis.commands"]` that contains a dict `{"count": 3, "first_ten": ["cmd1", "cmd2", ...]}` but instead `span["data"]["redis.commands.count"]` (containing `3`) and `span["data"]["redis.commands.first_ten"]` (containing `["cmd1", "cmd2", ...]`).
29
-
- clickhouse-driver integration: The query is now available under the `db.query.text` span attribute (only if `send_default_pii` is `True`).
30
-
-`sentry_sdk.init` now returns `None` instead of a context manager.
31
-
- The `sampling_context` argument of `traces_sampler` and `profiles_sampler` now additionally contains all span attributes known at span start.
32
-
- We updated how we handle `ExceptionGroup`s. You will now get more data if ExceptionGroups are appearing in chained exceptions. It could happen that after updating the SDK the grouping of issues change because of this. So eventually you will see the same exception in two Sentry issues (one from before the update, one from after the update)
33
-
- The integration for Python `logging` module does not send Sentry issues by default anymore when calling `logging.error()`, `logging.critical()` or `logging.exception()`. If you want to preserve the old behavior use `sentry_sdk.init(integrations=[LoggingIntegration(event_level="ERROR")])`.
34
-
- The `SentrySpanProcessor` and `SentryPropagator` are exported from `sentry_sdk.opentelemetry` instead of `sentry_sdk.integrations.opentelemetry`.
42
+
43
+
44
+
#### Integrations
45
+
- Redis: In Redis pipeline spans there is no `span["data"]["redis.commands"]` that contains a dict `{"count": 3, "first_ten": ["cmd1", "cmd2", ...]}` but instead `span["data"]["redis.commands.count"]` (containing `3`) and `span["data"]["redis.commands.first_ten"]` (containing `["cmd1", "cmd2", ...]`).
46
+
- clickhouse-driver: The query is now available under the `db.query.text` span attribute (only if `send_default_pii` is `True`).
47
+
- Logging: By default, the SDK won't capture Sentry issues anymore when calling `logging.error()`, `logging.critical()` or `logging.exception()`. If you want to preserve the old behavior use `sentry_sdk.init(integrations=[LoggingIntegration(event_level="ERROR")])`.
35
48
- The integration-specific content of the `sampling_context` argument of `traces_sampler` and `profiles_sampler` now looks different.
36
49
37
50
- The Celery integration doesn't add the `celery_job` dictionary anymore. Instead, the individual keys are now available as:
@@ -136,55 +149,88 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
- The `sentry_sdk.Scope()` constructor no longer accepts a `client` parameter.
155
+
-`sentry_sdk.init` now returns `None` instead of a context manager.
156
+
139
157
### Removed
140
158
159
+
#### General
160
+
141
161
- Dropped support for Python 3.6.
162
+
-`set_measurement` has been removed.
163
+
- Setting `Scope.user` directly is no longer supported. Use `Scope.set_user()` instead.
164
+
165
+
#### Tracing
166
+
142
167
- The `enable_tracing``init` option has been removed. Configure `traces_sample_rate` directly.
143
168
- The `propagate_traces``init` option has been removed. Use `trace_propagation_targets` instead.
144
169
- The `custom_sampling_context` parameter of `start_transaction` has been removed. Use `attributes` instead to set key-value pairs of data that should be accessible in the traces sampler. Note that span attributes need to conform to the [OpenTelemetry specification](https://opentelemetry.io/docs/concepts/signals/traces/#attributes), meaning only certain types can be set as values.
145
-
-`set_measurement` has been removed.
146
-
- The PyMongo integration no longer sets tags. The data is still accessible via span attributes.
147
-
- The PyMongo integration doesn't set `operation_ids` anymore. The individual IDs (`operation_id`, `request_id`, `session_id`) are now accessible as separate span attributes.
148
-
-`sentry_sdk.metrics` and associated metrics APIs have been removed as Sentry no longer accepts metrics data in this form. See https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Upcoming-API-Changes-to-Metrics
149
-
- The experimental options `enable_metrics`, `before_emit_metric` and `metric_code_locations` have been removed.
150
170
- When setting span status, the HTTP status code is no longer automatically added as a tag.
151
-
- Class `Hub` has been removed.
152
-
- Class `_ScopeManager` has been removed.
153
-
- The context manager `auto_session_tracking()` has been removed. Use `track_session()` instead.
154
-
- The context manager `auto_session_tracking_scope()` has been removed. Use `track_session()` instead.
155
-
- Utility function `is_auto_session_tracking_enabled()` has been removed. There is no public replacement. There is a private `_is_auto_session_tracking_enabled()` (if you absolutely need this function) It accepts a `scope` parameter instead of the previously used `hub` parameter.
156
-
- Utility function `is_auto_session_tracking_enabled_scope()` has been removed. There is no public replacement. There is a private `_is_auto_session_tracking_enabled()` (if you absolutely need this function).
157
-
- Setting `scope.level` has been removed. Use `scope.set_level` instead.
158
-
-`span.containing_transaction` has been removed. Use `span.root_span` instead.
159
-
-`continue_from_headers`, `continue_from_environ` and `from_traceparent` have been removed, please use top-level API `sentry_sdk.continue_trace` instead.
160
-
-`PropagationContext` constructor no longer takes a `dynamic_sampling_context` but takes a `baggage` object instead.
161
-
-`ThreadingIntegration` no longer takes the `propagate_hub` argument.
162
-
-`Baggage.populate_from_transaction` has been removed.
163
-
-`debug.configure_debug_hub` was removed.
164
-
-`profiles_sample_rate` and `profiler_mode` were removed from options available via `_experiments`. Use the top-level `profiles_sample_rate` and `profiler_mode` options instead.
165
-
-`Transport.capture_event` has been removed. Use `Transport.capture_envelope` instead.
166
-
- Function transports are no longer supported. Subclass the `Transport` instead.
167
-
-`start_transaction` (`start_span`) no longer takes the following arguments:
171
+
-`start_transaction` is deprecated and no longer takes the following arguments:
168
172
-`trace_id`, `baggage`: use `continue_trace` for propagation from headers or environment variables
169
173
-`same_process_as_parent`
170
174
-`span_id`
171
175
-`parent_span_id`: you can supply a `parent_span` instead
172
176
- The `Scope.transaction` property has been removed. To obtain the root span (previously transaction), use `Scope.root_span`. To set the root span's (transaction's) name, use `Scope.set_transaction_name()`.
173
177
- The `Scope.span =` setter has been removed. Please use the new `span.activate()` api instead if you want to activate a new span manually instead of using the `start_span` context manager.
174
-
- Passing a list or `None` for `failed_request_status_codes` in the Starlette integration is no longer supported. Pass a set of integers instead.
178
+
-`span.containing_transaction` has been removed. Use `span.root_span` instead.
179
+
-`continue_from_headers`, `continue_from_environ` and `from_traceparent` have been removed, please use top-level API `sentry_sdk.continue_trace` instead.
180
+
-`Baggage.populate_from_transaction` has been removed.
181
+
182
+
#### Integrations
183
+
184
+
- PyMongo: The integration no longer sets tags. The data is still accessible via span attributes.
185
+
- PyMongo: The integration doesn't set `operation_ids` anymore. The individual IDs (`operation_id`, `request_id`, `session_id`) are now accessible as separate span attributes.
186
+
- Django: Dropped support for Django versions below 2.0.
187
+
- trytond: Dropped support for trytond versions below 5.0.
188
+
- Falcon: Dropped support for Falcon versions below 3.0.
189
+
- eventlet: Dropped support for eventlet completely.
190
+
- Threading: The integration no longer takes the `propagate_hub` argument.
191
+
- Starlette: Passing a list or `None` for `failed_request_status_codes` is no longer supported. Pass a set of integers instead.
192
+
193
+
#### Profiling
194
+
195
+
-`profiles_sample_rate` and `profiler_mode` were removed from options available via `_experiments`. Use the top-level `profiles_sample_rate` and `profiler_mode` options instead.
196
+
197
+
#### Transport
198
+
199
+
-`Transport.capture_event` has been removed. Use `Transport.capture_envelope` instead.
200
+
- Function transports are no longer supported. Subclass the `Transport` instead.
201
+
202
+
#### Sessions
203
+
204
+
- The context manager `auto_session_tracking()` has been removed. Use `track_session()` instead.
205
+
- The context manager `auto_session_tracking_scope()` has been removed. Use `track_session()` instead.
206
+
- Utility function `is_auto_session_tracking_enabled()` has been removed. There is no public replacement. There is a private `_is_auto_session_tracking_enabled()` (if you absolutely need this function) It accepts a `scope` parameter instead of the previously used `hub` parameter.
207
+
- Utility function `is_auto_session_tracking_enabled_scope()` has been removed. There is no public replacement. There is a private `_is_auto_session_tracking_enabled()` (if you absolutely need this function).
208
+
209
+
#### Metrics
210
+
211
+
-`sentry_sdk.metrics` and associated metrics APIs have been removed as Sentry no longer accepts metrics data in this form. See https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Upcoming-API-Changes-to-Metrics
212
+
- The experimental options `enable_metrics`, `before_emit_metric` and `metric_code_locations` have been removed.
213
+
214
+
#### Internals
215
+
216
+
- Class `Hub` has been removed.
217
+
- Class `_ScopeManager` has been removed.
218
+
-`PropagationContext` constructor no longer takes a `dynamic_sampling_context` but takes a `baggage` object instead.
219
+
- Setting `scope.level` has been removed. Use `scope.set_level` instead.
220
+
-`debug.configure_debug_hub` was removed.
175
221
- The `span` argument of `Scope.trace_propagation_meta` is no longer supported.
176
-
- Setting `Scope.user` directly is no longer supported. Use `Scope.set_user()` instead.
177
-
- Dropped support for Django versions below 2.0.
178
-
- Dropped support for trytond versions below 5.0.
179
-
- Dropped support for Falcon versions below 3.0.
180
-
- Dropped support for eventlet completely.
222
+
181
223
182
224
### Deprecated
183
225
184
226
-`sentry_sdk.start_transaction()` is deprecated. Use `sentry_sdk.start_span()` instead.
185
227
- If you want to force creation of a new trace, use the `sentry_sdk.new_trace()` context manager.
186
228
-`Span.set_data()` is deprecated. Use `Span.set_attribute()` instead.
Looking to upgrade from Sentry SDK 1.x to 2.x? Here's a comprehensive list of what's changed. Looking for a more digestible summary? See the [guide in the docs](https://docs.sentry.io/platforms/python/migration/1.x-to-2.x) with the most common migration patterns.
0 commit comments