Skip to content

Commit 4ccc0e6

Browse files
committed
Merge branch 'potel-base' into ivana/potel/port-logging-options
2 parents 5a217d5 + 01cc131 commit 4ccc0e6

File tree

1 file changed

+89
-41
lines changed

1 file changed

+89
-41
lines changed

MIGRATION_GUIDE.md

Lines changed: 89 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,44 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
1010

1111
### Changed
1212

13+
#### General
14+
1315
- The SDK now supports Python 3.7 and higher.
14-
- `enable_logs` and `before_send_log` are now regular SDK options. Their original versions under `_experiments` have been removed.
15-
- 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
1616
- 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
1725
- `sentry_sdk.start_span` now only takes keyword arguments.
1826
- `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`.
19-
- 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`.
2029
- The `Span()` constructor does not accept a `hub` parameter anymore.
21-
- The `sentry_sdk.Scope()` constructor no longer accepts a `client` parameter.
2230
- `Span.finish()` does not accept a `hub` parameter anymore.
23-
- `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.
2438
- The `Profile()` constructor does not accept a `hub` parameter anymore.
2539
- A `Profile` object does not have a `.hub` property anymore.
2640
- `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`.
2741
- `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`.
28-
- `sentry_sdk.continue_trace` no longer returns a `Transaction` and is now a context manager.
29-
- 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", ...]`).
30-
- clickhouse-driver integration: The query is now available under the `db.query.text` span attribute (only if `send_default_pii` is `True`).
31-
- `sentry_sdk.init` now returns `None` instead of a context manager.
32-
- The `sampling_context` argument of `traces_sampler` and `profiles_sampler` now additionally contains all span attributes known at span start.
33-
- 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)
34-
- 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")])`.
35-
- The `SentrySpanProcessor` and `SentryPropagator` are exported from `sentry_sdk.opentelemetry` instead of `sentry_sdk.integrations.opentelemetry`.
42+
43+
#### Logs
44+
45+
- `enable_logs` and `before_send_log` are now regular SDK options. Their original versions under `_experiments` have been removed.
46+
47+
#### Integrations
48+
- 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", ...]`).
49+
- clickhouse-driver: The query is now available under the `db.query.text` span attribute (only if `send_default_pii` is `True`).
50+
- 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")])`.
3651
- The integration-specific content of the `sampling_context` argument of `traces_sampler` and `profiles_sampler` now looks different.
3752

3853
- The Celery integration doesn't add the `celery_job` dictionary anymore. Instead, the individual keys are now available as:
@@ -137,55 +152,88 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
137152
| `gcp_event.query_string` | `url.query` |
138153
| `gcp_event.headers` | `http.request.header.{header}` |
139154

155+
#### Internals
156+
157+
- The `sentry_sdk.Scope()` constructor no longer accepts a `client` parameter.
158+
- `sentry_sdk.init` now returns `None` instead of a context manager.
159+
140160
### Removed
141161

162+
#### General
163+
142164
- Dropped support for Python 3.6.
165+
- `set_measurement` has been removed.
166+
- Setting `Scope.user` directly is no longer supported. Use `Scope.set_user()` instead.
167+
168+
#### Tracing
169+
143170
- The `enable_tracing` `init` option has been removed. Configure `traces_sample_rate` directly.
144171
- The `propagate_traces` `init` option has been removed. Use `trace_propagation_targets` instead.
145172
- 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.
146-
- `set_measurement` has been removed.
147-
- The PyMongo integration no longer sets tags. The data is still accessible via span attributes.
148-
- 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.
149-
- `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
150-
- The experimental options `enable_metrics`, `before_emit_metric` and `metric_code_locations` have been removed.
151173
- When setting span status, the HTTP status code is no longer automatically added as a tag.
152-
- Class `Hub` has been removed.
153-
- Class `_ScopeManager` has been removed.
154-
- The context manager `auto_session_tracking()` has been removed. Use `track_session()` instead.
155-
- The context manager `auto_session_tracking_scope()` has been removed. Use `track_session()` instead.
156-
- 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.
157-
- 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).
158-
- Setting `scope.level` has been removed. Use `scope.set_level` instead.
159-
- `span.containing_transaction` has been removed. Use `span.root_span` instead.
160-
- `continue_from_headers`, `continue_from_environ` and `from_traceparent` have been removed, please use top-level API `sentry_sdk.continue_trace` instead.
161-
- `PropagationContext` constructor no longer takes a `dynamic_sampling_context` but takes a `baggage` object instead.
162-
- `ThreadingIntegration` no longer takes the `propagate_hub` argument.
163-
- `Baggage.populate_from_transaction` has been removed.
164-
- `debug.configure_debug_hub` was removed.
165-
- `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.
166-
- `Transport.capture_event` has been removed. Use `Transport.capture_envelope` instead.
167-
- Function transports are no longer supported. Subclass the `Transport` instead.
168-
- `start_transaction` (`start_span`) no longer takes the following arguments:
174+
- `start_transaction` is deprecated and no longer takes the following arguments:
169175
- `trace_id`, `baggage`: use `continue_trace` for propagation from headers or environment variables
170176
- `same_process_as_parent`
171177
- `span_id`
172178
- `parent_span_id`: you can supply a `parent_span` instead
173179
- 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()`.
174180
- 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.
175-
- Passing a list or `None` for `failed_request_status_codes` in the Starlette integration is no longer supported. Pass a set of integers instead.
181+
- `span.containing_transaction` has been removed. Use `span.root_span` instead.
182+
- `continue_from_headers`, `continue_from_environ` and `from_traceparent` have been removed, please use top-level API `sentry_sdk.continue_trace` instead.
183+
- `Baggage.populate_from_transaction` has been removed.
184+
185+
#### Integrations
186+
187+
- PyMongo: The integration no longer sets tags. The data is still accessible via span attributes.
188+
- 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.
189+
- Django: Dropped support for Django versions below 2.0.
190+
- trytond: Dropped support for trytond versions below 5.0.
191+
- Falcon: Dropped support for Falcon versions below 3.0.
192+
- eventlet: Dropped support for eventlet completely.
193+
- Threading: The integration no longer takes the `propagate_hub` argument.
194+
- Starlette: Passing a list or `None` for `failed_request_status_codes` is no longer supported. Pass a set of integers instead.
195+
196+
#### Profiling
197+
198+
- `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.
199+
200+
#### Transport
201+
202+
- `Transport.capture_event` has been removed. Use `Transport.capture_envelope` instead.
203+
- Function transports are no longer supported. Subclass the `Transport` instead.
204+
205+
#### Sessions
206+
207+
- The context manager `auto_session_tracking()` has been removed. Use `track_session()` instead.
208+
- The context manager `auto_session_tracking_scope()` has been removed. Use `track_session()` instead.
209+
- 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.
210+
- 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).
211+
212+
#### Metrics
213+
214+
- `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
215+
- The experimental options `enable_metrics`, `before_emit_metric` and `metric_code_locations` have been removed.
216+
217+
#### Internals
218+
219+
- Class `Hub` has been removed.
220+
- Class `_ScopeManager` has been removed.
221+
- `PropagationContext` constructor no longer takes a `dynamic_sampling_context` but takes a `baggage` object instead.
222+
- Setting `scope.level` has been removed. Use `scope.set_level` instead.
223+
- `debug.configure_debug_hub` was removed.
176224
- The `span` argument of `Scope.trace_propagation_meta` is no longer supported.
177-
- Setting `Scope.user` directly is no longer supported. Use `Scope.set_user()` instead.
178-
- Dropped support for Django versions below 2.0.
179-
- Dropped support for trytond versions below 5.0.
180-
- Dropped support for Falcon versions below 3.0.
181-
- Dropped support for eventlet completely.
225+
182226

183227
### Deprecated
184228

185229
- `sentry_sdk.start_transaction()` is deprecated. Use `sentry_sdk.start_span()` instead.
186230
- If you want to force creation of a new trace, use the `sentry_sdk.new_trace()` context manager.
187231
- `Span.set_data()` is deprecated. Use `Span.set_attribute()` instead.
188232

233+
234+
---------------------------------------------------------------------------------
235+
236+
189237
## Upgrading to 2.0
190238

191239
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

Comments
 (0)