Skip to content

Next Python SDK major - #5005

Draft
sentrivana wants to merge 320 commits into
masterfrom
major/3.0
Draft

sentrivana wants to merge 320 commits into
masterfrom
major/3.0

Conversation

@sentrivana

@sentrivana sentrivana commented Oct 24, 2025 •

Copy link
Copy Markdown
Contributor

We're preparing our next major on this branch.

The project is tracked in Linear. If you don't have access, we'll try to tag issues belonging to the project with the SDK 3.0 label on GitHub so that you can follow along.

Notable changes

  • Transaction-based tracing will be removed. Span streaming will be the default tracing model.
  • Python 3.6 support will be removed.

Context

You might have read this announcement about us discontinuing work on a 3.0. This is referring to the work done on the potel-base branch, which included two types of changes: a huge refactor of our tracing code on the one hand, and various unrelated changes, improvements and fixes on the other. We're dropping the huge refactor part, and only porting the rest, to a new branch and eventually a new 3.0 release.

@codecov

codecov Bot commented Oct 24, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.76%. Comparing base (14aff96) to head (d864ba0).
⚠️ Report is 4 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5005       +/-   ##
===========================================
+ Coverage   70.55%   83.76%   +13.21%     
===========================================
  Files         180      180               
  Lines       18077    18080        +3     
  Branches     3008     3009        +1     
===========================================
+ Hits        12754    15145     +2391     
+ Misses       4432     1943     -2489     
- Partials      891      992      +101     
Files with missing lines Coverage Δ
sentry_sdk/integrations/__init__.py 88.42% <100.00%> (+0.37%) ⬆️

... and 61 files with indirect coverage changes

@github-actions

github-actions Bot commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ 57379 passed | ❌ 2 failed | ⏭️ 2709 skipped | Total: 60090 | Pass Rate: 95.49% | Execution Time: 162m 42s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -77616
Passed Tests 📉 -73205
Failed Tests 📈 +2
Skipped Tests 📉 -4413

➕ New Tests (2)

View new tests
  • test_input_attributes_nonstreaming_chat[messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
    • Status: ❌ Failing
  • test_headers[no headers]
    • File: tests.integrations.aws_lambda.test_aws_lambda
    • Status: ❌ Failing

❌ Failed Tests

test_input_attributes_nonstreaming_chat[messages0-expected_system_instructions0-expected_input_messages0]

File: tests.integrations.mistral.test_mistral
Suite: py3.10-mistral-v2.6.0
Error: KeyError: 139792746602496

Stack Trace
tests/integrations/mistral/test_mistral.py:389: in test_input_attributes_nonstreaming_chat
    sentry_init(
tests/conftest.py:349: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:278: in __init__
    self._init_impl()
sentry_sdk/client.py:428: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:217: in setup_integrations
    for integration_cls in iter_default_integrations(
sentry_sdk/integrations/__init__.py:44: in iter_default_integrations
    yield getattr(import_module(module), cls)
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1024: in _find_and_load
    ???
<frozen importlib._bootstrap>:171: in __enter__
    ???
<frozen importlib._bootstrap>:123: in acquire
    ???
E   KeyError: 139792746602496

test_headers[no headers]

File: tests.integrations.aws_lambda.test_aws_lambda
Suite: py3.9-aws_lambda
Error: ValueError: too many values to unpack (expected 1)

Stack Trace
tests/integrations/aws_lambda/test_aws_lambda.py:609: in test_headers
    (error_event,) = envelopes
E   ValueError: too many values to unpack (expected 1)

✅ Patch coverage is 90.05%. Project has 2070 uncovered lines.
❌ Project coverage is 90.05%. Comparing base (2a499ec) to head (b8d3978).

Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
- Coverage    90.25%    90.05%     -0.2%
==========================================
  Files          195       179       -16
  Lines        26195     20799     -5396
  Branches      9758      7314     -2444
==========================================
+ Hits         23641     18729     -4912
- Misses        2554      2070      -484
- Partials      1484      1220      -264

Generated by Codecov Action

@github-actions

github-actions Bot commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

⚪ None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (logging) Separate ignore lists for events/breadcrumbs and sentry logs by sl0thentr0py in #5698

Bug Fixes 🐛

Anthropic

  • Set exception info on streaming span when applicable by alexander-alderman-webb in #5683
  • Patch AsyncStream.close() and AsyncMessageStream.close() to finish spans by alexander-alderman-webb in #5675
  • Patch Stream.close() and MessageStream.close() to finish spans by alexander-alderman-webb in #5674

Documentation 📚

  • Add note on AI PRs to CONTRIBUTING.md by sentrivana in #5696

Internal Changes 🔧

  • Add -latest alias for each integration test suite by sentrivana in #5706
  • Use date-based branch names for toxgen PRs by sentrivana in #5704
  • 🤖 Update test matrix with new releases (03/19) by github-actions in #5703
  • Add client report tests for span streaming by sentrivana in #5677

Other

  • Next Python SDK major by sentrivana in #5005
  • Update CHANGELOG.md by sentrivana in #5685

🤖 This preview updates automatically when you update the PR.

Comment thread sentry_sdk/consts.py
Comment thread sentry_sdk/integrations/otlp.py
Comment thread tests/integrations/django/asgi/test_asgi.py
Comment thread sentry_sdk/integrations/otlp.py
Comment thread tests/integrations/threading/test_threading.py Outdated
Comment thread sentry_sdk/integrations/launchdarkly.py Outdated
Comment thread sentry_sdk/scope.py Outdated
Comment thread sentry_sdk/integrations/trytond.py
Comment thread sentry_sdk/integrations/chalice.py
Comment thread sentry_sdk/integrations/openai_agents/__init__.py
Comment thread sentry_sdk/integrations/pydantic_ai/__init__.py
Comment thread sentry_sdk/integrations/spark/spark_driver.py
Comment thread tests/integrations/launchdarkly/test_launchdarkly.py
Comment thread sentry_sdk/integrations/__init__.py Outdated
Comment thread sentry_sdk/integrations/openai_agents/__init__.py
Comment thread sentry_sdk/integrations/starlette.py
sentrivana added a commit that referenced this pull request Aug 6, 2026
Fixes for things that the bots
[surfaced](#5005) on the
major branch:
- some version checks were too late (after patching)
- fix TrytondWSGI integration name/`_MIN_VERSIONS` entry mismatch

Also, changed the warning of the `DidNotEnable` message from "X not
installed" to "X not installed or incompatible".
Comment thread sentry_sdk/integrations/redis/modules/queries.py
Comment thread sentry_sdk/integrations/langchain.py
Comment thread sentry_sdk/spotlight.py
Comment thread sentry_sdk/spotlight.py
sentrivana and others added 9 commits August 25, 2026 10:34
Use Hide whitespace ✨ 

Closes PY-2676
Closes #7072
…ion (#7180)

Modify the LiteLLM integration to respect the data_collection config for
controlling whether chat messages, embeddings inputs, and response text
are captured in spans.

When data collection is enabled, the new gen_ai.inputs and
gen_ai.outputs flags control what data is collected. When data
collection is not configured, falls back to legacy send_default_pii and
include_prompts settings for compatibility.

Refs PY-2588
Refs #6748
…7157)

### Description

These tests are event-only: they capture events, never spans, and the
`span_streaming` argument was only ever fed to `trace_lifecycle`. Both
arms exercised identical code paths and asserted identical payloads, so
the parametrize doubled the case count without adding coverage.

Tests that inspect spans or transactions keep their parametrize.

391 -> 356 cases.

Refs PY-2641
Refs #6975
…ption (#7175)

Modify the LangGraph integration to respect the data_collection config
for controlling whether prompts, responses, tool calls, and available
tools are captured in spans.

When data collection is enabled, the gen_ai.inputs flag controls request
messages, tool calls, and available tools, while gen_ai.outputs controls
the response text. Tool calls are gated on inputs because they are fed
back to the model as input. Available tools are only gated once data
collection is configured, since they were never gated on the legacy PII
settings.

When data collection is not configured, falls back to legacy
send_default_pii and include_prompts settings for compatibility.

Refs #6748  <br>Refs #6748
…ntrols (#7181)

Replace the single \_should_send_prompts check with \_should_send_inputs
and \_should_send_outputs, gated by the new
data_collection.gen_ai.inputs/outputs experimental options when set,
falling back to the existing send_default_pii

* include_prompts behavior otherwise. Available tools are now gated on
inputs specifically. This lets callers control request and response data
collection independently.

Refs PY-2588
Refs #6748
Quart 0.22.0
[reverts](pallets/quart@7337e5f)
a change that landed in 0.21.0. Adapt our test accordingly.
…lection is enabled (#7204)

When `data_collection` is configured, tool definitions should be set on
`GEN_AI_TOOL_DEFINITIONS` instead of the legacy
`GEN_AI_REQUEST_AVAILABLE_TOOLS` attribute, matching the updated gen-ai
semantic conventions. The legacy attribute is still used when
`data_collection` is not configured.

Also gate the response tool calls recorded in `on_llm_end` on the
`outputs` setting rather than `inputs`, since they are part of the
model's response.

Refs PY-2734
Refs #7200
…#7205)

Tool call data is part of the model's response, so it should be recorded
when `data_collection.gen_ai.outputs` is enabled, not gated on `inputs`.

Refs PY-2734
Refs #7200
pabloDeputter and others added 30 commits September 25, 2026 10:13
### Description
- `PyramidRequestExtractor` inherits from `RequestExtractor` which still
has some `send_default_pii` branching, but this will be fixed in #7616;
same for `SentryWsgiMiddleware`.

#### Issues
Resolves #7650
### Description
- drop `send_default_pii` support from Starlette integration.

#### Issues
Resolves #7612
### Description
- drop `send_default_pii` support for Pymongo integration.

#### Issues
Resolves #7605
### Description

* `SanicRequestExtractor` inherits from `RequestExtractor` which still
has some `send_default_pii` branching, but this will be fixed in #7616.

#### Issues

Resolves #7611
### Description
- `TornadoRequestExtractor` inherits from `RequestExtractor` which still
has some `send_default_pii` branching, but this will be fixed in #7616.

#### Issues
Resolves #7615
### Description
- `request_body_within_bounds()` still has some `send_default_pii`
branching, but this will be fixed in #7616.

#### Issues
Resolves #7726
### Description
Remove `send_default_pii` support from Huey integration.

#### Issues
Resolves #7594
### Description
Drop `send_default_pii` support for RQ integration.

#### Issues
Resolves #7609
### Description
Drop `send_default_pii` support from Starlite integration.

#### Issues
Resolves #7613
### Description
Drop `send_default_pii` support from Litestar integration.

#### Issues
Resolves #7599
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove data-collection-specific tests, as existing tests now exercise the same code paths.

Closes #7602
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove data-collection-specific tests, as existing tests now exercise the same code paths.

Closes #7587
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove cases of `_data_collection`-suffixed tests that are now exercised by existing tests.

Closes #7596
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove cases of `_data_collection`-suffixed tests that are now exercised by existing tests.

Closes #7598
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove cases of `_data_collection`-suffixed tests that are now exercised by existing tests.

Closes #7597
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove cases of `_data_collection`-suffixed tests that are now exercised by existing tests.

Closes #7592
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove cases of `_data_collection`-suffixed tests that are now exercised by existing tests.

Closes #7588
The `data_collection` option now fully governs user info, query string,
and header capture in the Quart integration; `send_default_pii` is no
longer consulted. Consolidates and dedupes the corresponding tests
around `data_collection` cases.

Fixes PY-2836
Fixes #7607
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove cases of `_data_collection`-suffixed tests that are now exercised by existing tests.

Closes #7595
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove data-collection-specific tests, as existing tests now exercise the same code paths.

Closes #7603
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove data-collection-specific tests, as existing tests now exercise the same code paths.

Closes #7604
Remove `send_default_pii` branches from the integration.
Add the `data_collection` option to all tests for the integration, with `gen_ai` options enabled if `send_default_pii=True` previously, and `gen_ai` options disabled if `send_default_pii=False` previously.
When `send_default_pii` was not previously supplied to `sentry_init()`, provide `data_collection={}`.
Split tests that were parametrized on `send_default_pii` into two tests with `gen_ai` options enabled and disabled (the latter suffixed with `_no_sensitive_data`).
Remove data-collection-specific tests, as existing tests now exercise the same code paths.

Closes #7600
…filter_headers (#7737)

_filter_headers now always uses the data_collection configuration for
request header filtering, removing the legacy send_default_pii fallback
path and the now-unused use_annotated_value parameter. Updates all call
sites across aiohttp, aws_lambda, chalice, gcp, quart, sanic, tornado,
wsgi, and _asgi_common accordingly, and removes tests covering the
removed legacy behaviour.

Refs PY-2853
Refs #7646
Always derive request cookies and body collection from `data_collection`
instead of falling back to `send_default_pii` when it isn't configured.

Remove the Django cookie-scrubbing tests that depended on
`send_default_pii`, and switch the remaining Django tests to
`data_collection={}`

Refs PY-2798
Refs #7566

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants