Skip to content

Next Python SDK major - #5005

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

sentrivana wants to merge 483 commits into
masterfrom
major/3.0

Conversation

@sentrivana

@sentrivana sentrivana commented Oct 24, 2025 •

Copy link
Copy Markdown
Collaborator

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

Coverage Results 📊

✅ 58898 passed | ⏭️ 3091 skipped | Total: 61989 | Pass Rate: 95.01% | Execution Time: 159m 12s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -85094
Passed Tests 📉 -80323
Failed Tests 📉 -1
Skipped Tests 📉 -4770

➖ Removed Tests (1)

View removed tests
  • test_openfeature_integration_threaded
    • File: tests.integrations.openfeature.test_openfeature

All tests are passing successfully.

✅ Patch coverage is 87.88% (3176 of 3614 changed executable lines covered; target 80%).
Project statement coverage is 90.12% (down 0.10 percentage points from base (c12eb30) to head (59e3262)).

Changed files with executable lines (146)
File Patch coverage Changed executable lines
sentry_sdk/integrations/aws_lambda/_handler.py 16.55% 24/145 covered; missed: 53, 54, 55, 57, 58, 59, 61, 69, 76, 77, 78, 79, 80, 81, 82, 86, 92, 93, 94, 96, 97, 99, 104, 105, 107, 108, 109, 110, 112, 116, 118, 119, 132, 133, 135, 136, 138, 139, 141, 143, 147, 149, 150, 151, 152, 153, 154, 162, 166, 170, 178, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 196, 197, 198, 202, 203, 204, 205, 206, 210, 211, 215, 216, 217, 218, 220, 225, 227, 238, 239, 241, 242, 243, 244, 245, 246, 247, 249, 266, 267, 268, 269, 271, 275, 276, 277, 284, 285, 290, 292, 293, 294, 295, 296, 298, 299, 301, 305, 307, 312, 313, 333, 334, 335, 336, 337, 341, 342, 344, 345, 347
sentry_sdk/integrations/aws_lambda/_runtime.py 22.00% 11/50 covered; missed: 23, 25, 26, 28, 29, 31, 32, 33, 37, 41, 42, 43, 47, 68, 70, 72, 76, 77, 78, 79, 82, 101, 102, 103, 104, 106, 109, 110, 112, 115, 117, 121, 122, 123, 124, 125, 126, 127, 138
sentry_sdk/integrations/aws_lambda/_request.py 69.86% 51/73 covered; missed: 19, 25, 27, 28, 29, 31, 32, 33, 35, 68, 76, 77, 78, 82, 83, 91, 92, 93, 97, 98, 101, 120; partial branches: 18, 22, 67, 75, 88, 90, 95, 96, 119
sentry_sdk/integrations/langchain.py 90.26% 139/154 covered; missed: 237, 274, 388, 405, 414, 492, 501, 507, 522, 528, 548, 591, 592, 598, 1244; partial branches: 236, 273, 285, 387, 404, 413, 491, 500, 506, 521, 527, 547
sentry_sdk/integrations/aws_lambda/_trigger.py 17.86% 5/28 covered; missed: 42, 51, 53, 54, 55, 57, 58, 62, 63, 66, 68, 69, 71, 72, 74, 75, 77, 78, 80, 81, 85, 86, 88
sentry_sdk/integrations/ray.py 33.33% 11/33 covered; missed: 92, 94, 95, 104, 105, 106, 107, 108, 109, 111, 130, 134, 135, 138, 139, 140, 141, 143, 160, 161, 162, 163; partial branches: 129
sentry_sdk/integrations/aws_lambda/init.py 36.36% 12/33 covered; missed: 24, 28, 29, 30, 34, 36, 37, 41, 43, 47, 49, 52, 53, 57, 62, 63, 64, 65, 67, 69, 74
sentry_sdk/integrations/mcp.py 93.55% 87/93 covered; missed: 279, 283, 355, 359, 403, 405; partial branches: 278, 282, 288, 354, 358, 366, 371, 386, 389, 393, 395, 398, 447, 449
sentry_sdk/integrations/anthropic.py 76.92% 30/39 covered; missed: 517, 519, 521, 525, 530, 756, 855, 1073, 1175; partial branches: 529, 755, 854, 1072, 1174
sentry_sdk/integrations/google_genai/init.py 80.65% 50/62 covered; missed: 76, 106, 139, 140, 142, 144, 170, 243, 262, 263, 264, 265; partial branches: 75, 242
sentry_sdk/integrations/socket.py 59.09% 13/22 covered; missed: 59, 96, 107, 108, 114, 115, 116, 117, 118; partial branches: 58, 68, 95, 105, 112
sentry_sdk/integrations/gcp.py 7.14% 1/14 covered; missed: 88, 89, 100, 104, 105, 131, 132, 134, 225, 226, 230, 231, 237
sentry_sdk/integrations/openai_agents/patches/runner.py 80.95% 34/42 covered; missed: 152, 173, 178, 179, 196, 201, 202, 203; partial branches: 151, 164, 169, 193
sentry_sdk/integrations/litestar.py 85.00% 34/40 covered; missed: 169, 184, 186, 204, 206, 272; partial branches: 168, 183, 185, 203, 205
sentry_sdk/integrations/asyncpg.py 86.21% 25/29 covered; missed: 216, 217, 244, 245; partial branches: 113, 212, 240, 247, 250
sentry_sdk/integrations/pydantic_ai/spans/ai_client.py 86.11% 31/36 covered; missed: 330, 331, 332, 333, 334; partial branches: 295, 300, 305, 323
sentry_sdk/integrations/mistral.py 92.31% 48/52 covered; missed: 321, 325, 441, 445; partial branches: 320, 324, 440, 444
sentry_sdk/integrations/openai_agents/spans/ai_client.py 87.10% 27/31 covered; missed: 227, 228, 239, 255; partial branches: 225, 230, 238, 254
sentry_sdk/integrations/otlp.py 87.10% 27/31 covered; missed: 154, 158, 180, 219; partial branches: 149, 153, 157, 174
sentry_sdk/integrations/pydantic_ai/spans/invoke_agent.py 100.00% 41/41 covered; partial branches: 65, 68, 76, 94, 102, 109, 111, 119
sentry_sdk/integrations/boto3/_utils.py 95.31% 61/64 covered; missed: 47, 114, 115; partial branches: 46, 50, 111, 113
sentry_sdk/integrations/openai_agents/patches/agent_run.py 58.33% 7/12 covered; missed: 60, 225, 232, 254, 263; partial branches: 104, 182
sentry_sdk/integrations/quart.py 86.84% 33/38 covered; missed: 105, 107, 108, 148, 149; partial branches: 190, 200
sentry_sdk/integrations/aiohttp.py 95.45% 63/66 covered; missed: 331, 332, 333; partial branches: 169, 263, 330
sentry_sdk/integrations/asgi.py 86.49% 32/37 covered; missed: 244, 246, 248, 249, 254; partial branches: 230
sentry_sdk/integrations/boto3/_services/bedrock.py 92.31% 24/26 covered; missed: 647, 731; partial branches: 142, 646, 656, 711
sentry_sdk/integrations/django/init.py 94.92% 56/59 covered; missed: 805, 824, 900; partial branches: 590, 804, 823
sentry_sdk/integrations/openai.py 96.84% 92/95 covered; missed: 413, 524, 794; partial branches: 585, 604, 793
sentry_sdk/integrations/starlette.py 93.48% 43/46 covered; missed: 109, 165, 801; partial branches: 164, 540, 738
sentry_sdk/integrations/typesafe.py 90.00% 18/20 covered; missed: 289, 375; partial branches: 253, 288, 339, 374
sentry_sdk/integrations/sqlalchemy.py 86.67% 13/15 covered; missed: 169, 173; partial branches: 82, 150, 164
sentry_sdk/_init_implementation.py 89.47% 17/19 covered; missed: 21, 33; partial branches: 20, 32
sentry_sdk/integrations/aiomysql.py 100.00% 21/21 covered; partial branches: 97, 101, 145, 149
sentry_sdk/integrations/boto3/_services/sqs.py 98.00% 98/100 covered; missed: 53, 54; partial branches: 117, 127
sentry_sdk/integrations/chalice.py 94.29% 33/35 covered; missed: 97, 141; partial branches: 96, 100
sentry_sdk/integrations/cohere.py 81.82% 18/22 covered; missed: 144, 149, 158, 260
sentry_sdk/integrations/django/caching.py 97.37% 37/38 covered; missed: 62; partial branches: 61, 81, 108
sentry_sdk/integrations/django/templates.py 77.78% 7/9 covered; missed: 58, 92; partial branches: 57, 91
sentry_sdk/integrations/django/views.py 84.62% 11/13 covered; missed: 25, 75; partial branches: 24, 74
sentry_sdk/integrations/langgraph.py 97.37% 37/38 covered; missed: 275; partial branches: 118, 137, 272
sentry_sdk/integrations/openai_agents/init.py 96.77% 30/31 covered; missed: 133; partial branches: 90, 116, 126
sentry_sdk/client.py 93.55% 29/31 covered; missed: 420, 421; partial branches: 846
sentry_sdk/integrations/flask.py 66.67% 6/9 covered; missed: 48, 142, 143
sentry_sdk/integrations/google_genai/utils.py 88.46% 23/26 covered; missed: 711, 720, 909
sentry_sdk/integrations/grpc/aio/client.py 87.50% 14/16 covered; missed: 90, 93; partial branches: 89
sentry_sdk/integrations/grpc/client.py 85.71% 12/14 covered; missed: 64, 67; partial branches: 63
sentry_sdk/integrations/starlite.py 87.50% 14/16 covered; missed: 155, 247; partial branches: 154
sentry_sdk/scope.py 100.00% 66/66 covered; partial branches: 745, 1480, 1522
sentry_sdk/data_collection.py 83.33% 5/6 covered; missed: 260; partial branches: 259
sentry_sdk/integrations/celery/init.py 100.00% 37/37 covered; partial branches: 105, 366
sentry_sdk/integrations/django/asgi.py 90.00% 9/10 covered; missed: 181; partial branches: 180
sentry_sdk/integrations/django/middleware.py 80.00% 4/5 covered; missed: 80; partial branches: 79
sentry_sdk/integrations/django/transactions.py 71.43% 5/7 covered; missed: 16, 17
sentry_sdk/integrations/google_genai/streaming.py 84.62% 11/13 covered; missed: 115, 119
sentry_sdk/integrations/grpc/server.py 66.67% 4/6 covered; missed: 62, 63
sentry_sdk/integrations/huggingface_hub.py 93.33% 28/30 covered; missed: 232, 427
sentry_sdk/integrations/pure_eval.py 33.33% 1/3 covered; missed: 24, 30
sentry_sdk/integrations/pyramid.py 86.67% 13/15 covered; missed: 78, 79
sentry_sdk/integrations/pyreqwest.py 100.00% 19/19 covered; partial branches: 139, 163
sentry_sdk/integrations/strawberry.py 97.67% 42/43 covered; missed: 271; partial branches: 270
sentry_sdk/integrations/tornado.py 100.00% 46/46 covered; partial branches: 134, 136
sentry_sdk/traces.py 96.67% 58/60 covered; missed: 293, 678
sentry_sdk/tracing_utils.py 100.00% 29/29 covered; partial branches: 140, 292
sentry_sdk/utils.py 94.87% 37/39 covered; missed: 1406, 1983
sentry_sdk/api.py 91.67% 11/12 covered; missed: 178
sentry_sdk/integrations/arq.py 100.00% 14/14 covered; partial branches: 189
sentry_sdk/integrations/asyncio.py 87.50% 7/8 covered; missed: 164
sentry_sdk/integrations/boto3/_services/kinesis.py 100.00% 24/24 covered; partial branches: 23
sentry_sdk/integrations/boto3/services/lambda.py 100.00% 54/54 covered; partial branches: 47
sentry_sdk/integrations/boto3/_services/stepfunctions.py 100.00% 42/42 covered; partial branches: 59
sentry_sdk/integrations/bottle.py 100.00% 11/11 covered; partial branches: 118
sentry_sdk/integrations/dramatiq.py 100.00% 17/17 covered; partial branches: 170
sentry_sdk/integrations/falcon.py 100.00% 15/15 covered; partial branches: 97
sentry_sdk/integrations/httpx.py 100.00% 40/40 covered; partial branches: 177
sentry_sdk/integrations/httpx2.py 100.00% 40/40 covered; partial branches: 177
sentry_sdk/integrations/litellm.py 100.00% 14/14 covered; partial branches: 124
sentry_sdk/integrations/logging.py 100.00% 29/29 covered; partial branches: 148
sentry_sdk/integrations/loguru.py 100.00% 14/14 covered; partial branches: 154
sentry_sdk/integrations/openai_agents/patches/error_tracing.py 100.00% 3/3 covered; partial branches: 58
sentry_sdk/integrations/pymongo.py 100.00% 24/24 covered; partial branches: 108
sentry_sdk/integrations/redis/modules/queries.py 100.00% 10/10 covered; partial branches: 55
sentry_sdk/integrations/redis/utils.py 100.00% 7/7 covered; partial branches: 107
sentry_sdk/integrations/rq.py 100.00% 15/15 covered; partial branches: 124
sentry_sdk/integrations/sanic.py 100.00% 32/32 covered; partial branches: 186
sentry_sdk/integrations/threading.py 50.00% 1/2 covered; missed: 65
sentry_sdk/integrations/wsgi.py 100.00% 38/38 covered; partial branches: 425
sentry_sdk/profiler/continuous_profiler.py 50.00% 1/2 covered; missed: 84
sentry_sdk/_compat.py 100.00% 4/4 covered
sentry_sdk/_span_batcher.py 100.00% 11/11 covered
sentry_sdk/_types.py 100.00% 1/1 covered
sentry_sdk/ai/utils.py 100.00% 2/2 covered
sentry_sdk/consts.py 100.00% 98/98 covered
sentry_sdk/envelope.py 100.00% 1/1 covered
sentry_sdk/feature_flags.py 100.00% 3/3 covered
sentry_sdk/integrations/init.py 100.00% 3/3 covered
sentry_sdk/integrations/_asgi_common.py 100.00% 20/20 covered
sentry_sdk/integrations/_wsgi_common.py 100.00% 11/11 covered
sentry_sdk/integrations/ariadne.py 100.00% 9/9 covered
sentry_sdk/integrations/aws_lambda/consts.py 100.00% 5/5 covered
sentry_sdk/integrations/beam.py 100.00% 7/7 covered
sentry_sdk/integrations/boto3/init.py 100.00% 2/2 covered
sentry_sdk/integrations/boto3/_client.py 100.00% 40/40 covered
sentry_sdk/integrations/boto3/_context.py 100.00% 1/1 covered
sentry_sdk/integrations/boto3/_instrumentation.py 100.00% 32/32 covered
sentry_sdk/integrations/boto3/_services/base.py 100.00% 3/3 covered
sentry_sdk/integrations/boto3/_services/dynamodb.py 100.00% 12/12 covered
sentry_sdk/integrations/boto3/_services/s3.py 100.00% 51/51 covered
sentry_sdk/integrations/boto3/_services/secretsmanager.py 100.00% 27/27 covered
sentry_sdk/integrations/boto3/_services/sns.py 100.00% 67/67 covered
sentry_sdk/integrations/boto3/consts.py 100.00% 2/2 covered
sentry_sdk/integrations/clickhouse_driver.py 100.00% 19/19 covered
sentry_sdk/integrations/dedupe.py 100.00% 5/5 covered
sentry_sdk/integrations/django/signals_handlers.py 100.00% 4/4 covered
sentry_sdk/integrations/django/tasks.py 100.00% 4/4 covered
sentry_sdk/integrations/executing.py 100.00% 1/1 covered
sentry_sdk/integrations/fastapi.py 100.00% 14/14 covered
sentry_sdk/integrations/gql.py 100.00% 5/5 covered
sentry_sdk/integrations/graphene.py 100.00% 12/12 covered
sentry_sdk/integrations/grpc/init.py 100.00% 2/2 covered
sentry_sdk/integrations/grpc/aio/server.py 100.00% 10/10 covered
sentry_sdk/integrations/huey.py 100.00% 16/16 covered
sentry_sdk/integrations/launchdarkly.py 100.00% 9/9 covered
sentry_sdk/integrations/openai_agents/patches/models.py 100.00% 9/9 covered
sentry_sdk/integrations/openai_agents/spans/init.py 100.00% 1/1 covered
sentry_sdk/integrations/openai_agents/spans/execute_tool.py 100.00% 8/8 covered
sentry_sdk/integrations/openai_agents/spans/invoke_agent.py 100.00% 8/8 covered
sentry_sdk/integrations/openai_agents/utils.py 100.00% 15/15 covered
sentry_sdk/integrations/openfeature.py 100.00% 5/5 covered
sentry_sdk/integrations/pydantic_ai/init.py 100.00% 46/46 covered
sentry_sdk/integrations/pydantic_ai/spans/init.py 100.00% 1/1 covered
sentry_sdk/integrations/pydantic_ai/spans/execute_tool.py 100.00% 10/10 covered
sentry_sdk/integrations/pydantic_ai/spans/utils.py 100.00% 5/5 covered
sentry_sdk/integrations/pydantic_ai/utils.py 100.00% 10/10 covered
sentry_sdk/integrations/redis/init.py 100.00% 7/7 covered
sentry_sdk/integrations/redis/_async_common.py 100.00% 15/15 covered
sentry_sdk/integrations/redis/_sync_common.py 100.00% 9/9 covered
sentry_sdk/integrations/redis/modules/caches.py 100.00% 7/7 covered
sentry_sdk/integrations/redis/redis.py 100.00% 3/3 covered
sentry_sdk/integrations/rust_tracing.py 100.00% 12/12 covered
sentry_sdk/integrations/spark/spark_driver.py 100.00% 8/8 covered
sentry_sdk/integrations/statsig.py 100.00% 1/1 covered
sentry_sdk/integrations/stdlib.py 100.00% 32/32 covered
sentry_sdk/integrations/trytond.py 100.00% 11/11 covered
sentry_sdk/integrations/typer.py 100.00% 5/5 covered
sentry_sdk/integrations/unleash.py 100.00% 5/5 covered
sentry_sdk/transport.py 100.00% 3/3 covered
Coverage diff
@@            Coverage Diff             @@
##        master     #5005       +/-##
==========================================
- Coverage    90.22%    90.12%    -0.10%
==========================================
  Files          203       200        -3
  Tracked lines     27335     22086     -5249
  Branches     10246      7738     -2508
==========================================
- Hits         24661     19903     -4758
+ Misses        2674      2183      -491
+ Partials      1558      1276      -282

Generated by Coverage 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 Resolved
Comment thread sentry_sdk/integrations/otlp.py Resolved
Comment thread sentry_sdk/integrations/otlp.py Resolved
Comment thread sentry_sdk/integrations/launchdarkly.py Resolved
Comment thread sentry_sdk/scope.py Resolved
Comment thread sentry_sdk/integrations/trytond.py Resolved
Comment thread sentry_sdk/integrations/chalice.py Resolved
Comment thread sentry_sdk/integrations/__init__.py Resolved
Comment thread sentry_sdk/integrations/starlette.py Resolved
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/langchain.py Resolved
Comment thread sentry_sdk/spotlight.py Resolved
Comment thread sentry_sdk/spotlight.py Resolved
Comment thread sentry_sdk/integrations/otlp.py Resolved
Comment thread sentry_sdk/integrations/aiomysql.py Resolved
Comment thread sentry_sdk/integrations/aiomysql.py Resolved
Comment thread MIGRATION_GUIDE.md Resolved
Comment thread sentry_sdk/integrations/otlp.py Resolved
Comment thread sentry_sdk/integrations/pyramid.py Resolved
Comment thread sentry_sdk/integrations/strawberry.py Resolved
Comment thread sentry_sdk/integrations/stdlib.py Resolved
Comment thread sentry_sdk/integrations/stdlib.py Resolved
Comment thread sentry_sdk/integrations/__init__.py Resolved
Comment thread sentry_sdk/integrations/threading.py Resolved
Comment thread tests/integrations/httpx/test_httpx.py Resolved
sentrivana added a commit that referenced this pull request Aug 26, 2026
Originally raised by a bot
[here](#5005 (comment)):
the `parse_version` function parses version strings as is (e.g. 3.1
becomes `(3, 1)`). We use these parsed version tuples in integrations to
compare the installed version against the minimum (defined in
`integrations/__init__.py`). The minimum versions are often three-part,
e.g. `(3, 1, 0)`.

This means that we can mistakenly consider a valid version to be below
the minimum, because in pure tuple terms, `(3, 1) < (3, 1, 0)` is true.

This can also happen in reverse (package version has three parts, while
our min version boundary has two).

In this PR, we make the internal version comparison work as expected
regardless of mismatches in the length of the version strings/tuples.
Comment thread sentry_sdk/integrations/typer.py Resolved
Comment thread sentry_sdk/_init_implementation.py Resolved
Comment thread sentry_sdk/integrations/arq.py Resolved
Comment thread sentry_sdk/integrations/asgi.py Resolved
Comment thread sentry_sdk/integrations/strawberry.py Resolved
Comment thread sentry_sdk/integrations/redis/redis.py Resolved
Comment thread sentry_sdk/integrations/stdlib.py Resolved
Comment thread MIGRATION_GUIDE.md Resolved
Comment thread MIGRATION_GUIDE.md Resolved
Comment thread sentry_sdk/consts.py Resolved
Comment thread sentry_sdk/integrations/anthropic.py Resolved
Comment thread sentry_sdk/integrations/ray.py Resolved
Comment thread MIGRATION_GUIDE.md Resolved
Comment thread sentry_sdk/integrations/pymongo.py Resolved
Comment thread sentry_sdk/transport.py Resolved
@sentry-junior
sentry-junior Bot added this pull request to stack #8202 November 6, 2026 08:28
@sentry-junior
sentry-junior Bot removed this pull request from stack #8202 November 6, 2026 09:50
@sentry-junior
sentry-junior Bot added this pull request to stack #8220 November 9, 2026 07:10
@sentry-junior
sentry-junior Bot removed this pull request from stack #8220 November 9, 2026 13:54
Comment thread sentry_sdk/_init_implementation.py Resolved
sentrivana and others added 8 commits November 9, 2026 16:55
### Description

The [OTLP integration
spec](https://develop.sentry.dev/sdk/telemetry/traces/otlp/#integration-spec)
says the integration **MUST NOT** set up an automatic propagator.
Cross-service propagation should come from the user's OpenTelemetry
propagators instead.

Right now `OTLPIntegration` replaces the global OTel textmap with
`SentryOTLPPropagator` by default. That means outgoing requests carry
only `sentry-trace`/`baggage` and drop the W3C `traceparent`.

This follows the sentry-ruby approach (getsentry/sentry-ruby#3063):

- `setup_propagator` now defaults to `False`, so by default
`OTLPIntegration` leaves the global textmap alone. Users can still opt
in with `setup_propagator=True`.
- Tests cover both the default (global textmap untouched) and the
opt-in. The inject/extract tests opt in explicitly.
- Added a note to the migration guide. It covers the new default, how to
get the old behavior back, and how to send both W3C and Sentry headers
with a `CompositePropagator`.

Without any setup, OTel's default propagators apply (`tracecontext` +
`baggage`, or whatever `OTEL_PROPAGATORS` says).

Unlike the Ruby PR, this doesn't change the default of
`setup_otlp_traces_exporter`. The spec says it defaults to `True`.

Docs (`sentry-docs` OTLP page) still need to be updated to describe the
new default and manual propagator setup. That isn't part of this PR.

#### Issues
Closes #6732
Closes PY-2574

<!-- junior-request-attribution:start -->
via **Ivana Kellyer**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0BTREZTS2Z%3A1793953060.343649 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0BTREZTS2Z%3A1793953060.343649)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0BTREZTS2Z%3A1793953060.343649/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
### Description
Adds the following attributes:
- `faas.invoked_name` (function name), `faas.invoked_provider` (aws),
`faas.invoked_region` (region extracted from ARN, else the client's)
(all from OTel) on `Invoke`, `InvokeWithResponseStream` and
`InvokeAsync`
- `aws.lambda.target_function.name` on every other API with
`FunctionName` (getsentry/sentry-conventions#716)
- `aws.lambda.resource_mapping.id` on the event source mapping APIs,
from the request or response `UUID`

Other changes:
- `FunctionError` sets `error.type=lambda_function_error`
- whenever `ClientContext.custom` is available, we add trace propagation
headers; trace continuing in aws-lambda integration is not done yet



#### Issues
Resolves #8069
Part of #8071

---------

Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
Co-authored-by: Alexander Alderman Webb <alexander.webb@sentry.io>
### Description
Adds the SQS extension, now SQS MESSAGING operations become `queue.*`
spans so they show up in the Queues insight; all other SQS APIs stay
`rpc`:
- `SendMessage`, `SendMessageBatch`: `queue.publish`, kind `producer`
(default is `client`), named `send <queue>`
- `ReceiveMessage`: `queue.receive`, named `receive <queue>`
- `DeleteMessage`, `DeleteMessageBatch`: `queue.settle`, named `settle
<queue>`

Adds the following attributes:
- `messaging.system` (`aws_sqs`), `messaging.operation.type` and
`messaging.operation.name` on the messaging APIs (all from OTel)
- `messaging.batch.message_count` on batch APIs: submitted entries for
send/delete, returned messages for receive
- `messaging.message.id` on `SendMessage`, and on `ReceiveMessage` when
exactly one message is returned
- `aws.sqs.queue.url` and `messaging.destination.name` (queue name) on
every API with `QueueUrl`; destination name also from `QueueName` and
`SourceArn`


#### Issues
Resolves #7572 & PY-2803

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
Co-authored-by: Alexander Alderman Webb <alexander.webb@sentry.io>
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
### Description
Adds the SNS extension to the boto3 integration, now SNS `Publish` and
`PublishBatch` become `queue.publish` spans so they show up in the
Queues insight; all other operations stay on `rpc`:
- `Publish`, `PublishBatch`: `queue.publish`, kind `producer` (default
is `client`), named `send <topic>`, or `send <server.address>:<port>`
when the request has no destination

Adds the following attributes:
- `messaging.system` (`aws.sns`), `messaging.operation.type` (`send`)
and `messaging.operation.name` (`publish`) on the publish APIs (all from
OTel)
- `messaging.batch.message_count` on `PublishBatch`,
`messaging.message.id` on `Publish`
- `aws.sns.topic.arn` and `messaging.destination.name` (topic name) on
every API with `TopicArn`, `ResourceArn` or a topic `TargetArn`;
destination name also from `CreateTopic`'s `Name`

Other changes:
- `PhoneNumber` and platform-endpoint `TargetArn` publishes get
`messaging.destination.name=[Filtered]` (`send [Filtered]`)

#### Issues
Resolves #7573 & PY-2804

<!-- junior-request-attribution:start -->
via @dingsdax.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C9X9V5NMT%3A1793904671.980379 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
Co-authored-by: Alexander Alderman Webb <alexander.webb@sentry.io>
Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
@sentry-junior
sentry-junior Bot added this pull request to stack #8245 November 11, 2026 13:30
@sentry-junior
sentry-junior Bot removed this pull request from stack #8245 November 11, 2026 13:32
sentry-junior Bot and others added 3 commits November 11, 2026 14:44
### Description

Adds `Boto3Integration(propagate_traces=True)`. Setting it to `False`
stops the integration from changing the request params of AWS calls:

- Lambda `Invoke` no longer gets trace data in `ClientContext`.
- Once #8145 lands: SQS `SendMessage` / `SendMessageBatch` and SNS
`Publish` / `PublishBatch` no longer get `sentry-trace` / `baggage`
message attributes, and SQS `ReceiveMessage` no longer appends our names
to `MessageAttributeNames`.

The option gates the shared `get_request_params` hook, so it covers
every extension that uses it without per-service changes. Spans are
still created as before.

This is an escape hatch for setups where the added data breaks calls,
e.g. a queue or topic whose `MaximumMessageSize` is set below the 256
KiB the #8145 size check assumes, or consumers that reject unknown
attributes. The name matches `CeleryIntegration(propagate_traces=...)`.

HTTP `sentry-trace` / `baggage` headers on AWS requests are not
affected. They're also added by the stdlib integration and are already
controlled by `trace_propagation_targets`.

Independent of #8145. The SQS/SNS test cases pass trivially until #8145
is merged, and guard the option after that. Whichever PR merges second
needs a small conflict fix at the end of `test_trace_propagation.py`,
since both append tests there.

<!-- junior-request-attribution:start -->
via @sentrivana.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0BTREZTS2Z%3A1794401901.814229 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0BTREZTS2Z%3A1794401901.814229)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0BTREZTS2Z%3A1794401901.814229/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
### Description

Propagates the trace through SQS and SNS messages, so the consumer can
be linked back to the request that sent the message.

**Send side** (`SendMessage`, `SendMessageBatch`, `Publish`,
`PublishBatch`):
- Adds `sentry-trace` and `baggage` as `String` message attributes, on
the message or on each batch entry.
- Only when `trace_propagation_targets` match the endpoint.
- Skips a message if the caller already set these attributes, if it
would go over the 10-attribute limit, or if it would go over 256 KiB.
AWS would reject the message otherwise.
- Works on a copy of the params. The caller's dict isn't changed.

**Receive side** (`ReceiveMessage`):
- Adds `sentry-trace` and `baggage` to `MessageAttributeNames`, so SQS
returns them. Only when the span is recorded, and not when the caller
already asks for `All` or `.*`.
- Adds a span link to each distinct producer context in the received
messages, with `sentry.link.type: message_origin`.
- Reads the context from SQS message attributes, and from the JSON
envelope of an SNS notification without raw message delivery.

**Tests**: injection and extraction for single and batch calls, the
limits above, and a round-trip test: send a message, receive what was
injected, and check that the link points at the send span.

Stacked on #8142 (SNS), which is stacked on #8137 (SQS).

#### Issues
* resolves: PY-3008

<!-- junior-request-attribution:start -->
via @dingsdax.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C9X9V5NMT%3A1793904671.980379 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
Ran a deslop tool on the SDK. Didn't work that great. This is some
actionable stuff that it did.
sentry-junior Bot and others added 6 commits November 12, 2026 12:23
### Description

With #8117 (merged), a synchronous boto3 `Invoke` carries `sentry-trace`
and `baggage` in `ClientContext.custom`. This PR adds the receiving
side: the Lambda integration continues the trace from
`context.client_context.custom`. `ClientContext` wins over event
headers, because a forwarded HTTP event can still carry headers from
further upstream.

`sam local` drops `ClientContext`, so the new `ClientContextTrace` test
function hands the event's `client_context` to the runtime. That way the
container tests can cover it.

This is Pablo's code from `pablo/aws-lambda-client-context-trace`. The
one change: `client_context` and `custom` are read with `getattr`, so a
context object without them falls back to event headers instead of
failing. It's the first of three stacked PRs for the stretch Lambda
work: this PR → trigger detection (#8222) → `queue.process` spans
(#8223).

#### Issues
* resolves: PY-3009 (receiving side; #8117 does the injection)
* Part of #8071

<!-- junior-request-attribution:start -->
via @dingsdax.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C9X9V5NMT%3A1793904671.980379 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: Pablo Deputter <pablo.deputter@sentry.io>
Co-authored-by: Pablo Deputter <71842639+pabloDeputter@users.noreply.github.com>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
)

### Description

Since #8137, #8142, and #8145, boto3 puts `sentry-trace` in SQS and SNS
message attributes, but nothing reads it on the Lambda side. This PR is
the smallest change that closes the loop for SQS- and SNS-triggered
functions. The Lambda integration now reads `sentry-trace` from each
record and adds a `message_origin` link from the invocation span to each
distinct producer span. This matches what the boto3 `ReceiveMessage`
span already does. Messages never become the invocation's parent.

It reads:
- SQS records: `messageAttributes["sentry-trace"].stringValue`
- SNS records: `Sns.MessageAttributes["sentry-trace"].Value`
- SNS → SQS without raw message delivery: the SNS envelope in the SQS
`body`, the same as boto3 does

Links are deduplicated, because a batch send gives many messages the
same producer span, and capped at 128, OTel's default, because Lambda
can deliver up to 10,000 SQS messages at once.

**Scope.** This is intentionally kept separate from the stretch stack.
It doesn't add `faas.trigger` (#8222) or `queue.process` spans (#8223),
and it doesn't touch `messaging.batch.message_count` (#8229). The
invocation span is otherwise unchanged. Synchronous `Invoke` propagation
through `ClientContext` is #8221. That PR changes the `continue_trace`
call and this one only adds `links=`, so the two are independent.

The link-building code repeats boto3's `_message_link` in a Lambda-event
shape: Lambda records use `messageAttributes` / `stringValue` / `body`,
while the boto3 response uses `MessageAttributes` / `StringValue` /
`Body`. Importing from the boto3 integration would make `aws_lambda`
depend on botocore.

**Testing.** `test_producer_links` sends SQS, SNS, and SNS-to-SQS events
to `BasicOkSpanStreaming`. It asserts the segment span's `links` and
that the segment span has no parent. It passes in CI's Cloud (Lambda)
jobs, and `ruff` and `mypy sentry_sdk` pass. `codecov/patch` is red
because the Lambda tests run in `sam local` containers, so their
coverage isn't counted.

#### Issues
* Part of #8081

<!-- junior-request-attribution:start -->
via **webb**, @sentrivana.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC09M26BC6A1%3A1794211222.463239 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC09M26BC6A1%3A1794211222.463239)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC09M26BC6A1%3A1794211222.463239/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Alexander Webb <alexander.webb@sentry.io>
Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
… span (#8229)

### Description

The Lambda span set `messaging.batch.message_count` to `1` for every
event that isn't a list, and to `len(event)` for a top-level list. An
SQS or SNS delivery is a dict with `Records`, so a batch of 10 messages
reported 1. HTTP calls and direct invocations reported a batch they
don't have.

This PR removes the attribute from the Lambda span. The count belongs on
messaging spans, as in the OTel messaging conventions:
- boto3 `ReceiveMessage` and batch-send spans already set it (#8137,
#8142).
- For SQS/SNS-triggered Lambdas, the `queue.process` span in #8223 sets
it.

The JS SDK doesn't set it on the Lambda span either. The attribute was
added in 3.0 (#7941) and never shipped in 2.x, so no released behavior
changes.

Replaces #8219 (same commits). GitHub never ran CI on #8219.

**Note for review:** this is narrower than PY-3015, which asks to keep
the attribute for SQS/SNS deliveries. @alexander-alderman-webb, please
confirm that's OK.

#### Issues
* resolves: PY-3015

<!-- junior-request-attribution:start -->
via @dingsdax.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C9X9V5NMT%3A1793904671.980379 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
### Description

Sets `faas.trigger` on the Lambda span based on the shape of the
delivered event:
- `http`: API Gateway REST/HTTP, function URLs, ALB, CloudFront, AppSync
- `pubsub`: SQS, SNS, Kinesis, Kafka, MQ, SES, EventBridge
- `datasource`: S3, DynamoDB Streams, DocumentDB
- `timer`: EventBridge schedules
- `other`: anything else

The trigger is read from the event envelope, never from its payload.
`test_trigger` has one case per code path. Other event sources use the
same lookup table, so they have no extra cases.

This PR doesn't touch `messaging.batch.message_count`. That change is in
#8229.

This is Pablo's code from `pablo/aws-lambda-trigger`, without his batch
counting for the invocation span. It's the second of three stacked PRs
(#8221 → this → #8223).

#### Issues
* resolves: PY-3018 (`faas.trigger` part; the per-source attributes in
the issue aren't in this PR)
* Part of #8081

<!-- junior-request-attribution:start -->
via @dingsdax.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C9X9V5NMT%3A1793904671.980379 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: Pablo Deputter <pablo.deputter@sentry.io>
Co-authored-by: Pablo Deputter <71842639+pabloDeputter@users.noreply.github.com>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
### Description

For an SQS or SNS delivery, the handler now runs inside a
`queue.process` child span of kind `consumer`. The span has:
- `messaging.system`
- `messaging.operation.type` and `messaging.operation.name`, both
`process`
- the batch message count
- the destination name (queue or topic, from the first record)

This fills in the processing side of the Queues insight.

**Producer links move to this span.** The OTel messaging conventions put
a consumer's links to each message's creation context on its process
span. #8257 (merged) put them on the invocation span. This PR moves
them: the invocation span has no links anymore, and `queue.process` gets
them. The links are built by the same `_get_producer_links` from #8257
(dedupe, the cap of 128, skipping the continued trace), with no second
copy of that parsing. The tests reuse the `SQS_RECORD` / `SNS_RECORD`
fixtures and the `test_producer_links` cases already on `major/3.0`.
Those tests now assert the links on the process span and that the
invocation span has none.

For comparison, the JS SDK's Lambda integration adds no links. It only
continues the trace from `ClientContext` or headers. Its links are on
the SQS `ReceiveMessage` span only.

This is Pablo's code from `pablo/aws-lambda-messaging`, minus his link
code. On his branch it sat on top of HTTP and invocation attribute work
(PY-3017, PY-3019, PY-3021), which isn't part of the November plan. In
`_handler.py` I only wrapped the handler call in the process span.

`test_process_span_error` covers a handler that raises.

Open points for review:
- `messaging.message.id` on single-message process spans isn't added yet
(proposed in PY-3020).
- The destination name comes from the first record. The alternative is
to set it only when all records share it.

#### Issues
* resolves: PY-3020
* Part of #8083

<!-- junior-request-attribution:start -->
via @dingsdax, @sentrivana.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC09M26BC6A1%3A1794211222.463239 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC09M26BC6A1%3A1794211222.463239)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC09M26BC6A1%3A1794211222.463239/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: Pablo Deputter <pablo.deputter@sentry.io>
Co-authored-by: Pablo Deputter <71842639+pabloDeputter@users.noreply.github.com>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>

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.

4 participants