Skip to content

Commit 7d93a71

Browse files
committed
Merge branch 'major/3.0' into pablo/boto3-add-sqs/sns-propagation
2 parents 3d35077 + 36870b8 commit 7d93a71

74 files changed

Lines changed: 8744 additions & 7457 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/test-integrations-mcp.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: ["3.10","3.13","3.14","3.14t","3.15","3.15t"]
20+
python-version: ["3.10","3.11","3.13","3.14","3.14t","3.15","3.15t"]
2121
os: [ubuntu-22.04]
2222
env:
2323
# 3.7 runs in the python:X.Y container; tell uv to use that system Python.

‎CHANGELOG.md‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 3.0.0b4
4+
5+
This is a pre-release of the next Python SDK major, to be released in November 2026.
6+
7+
Want to give it a spin? Be our guest and [let us know](https://github.com/getsentry/sentry-python/discussions) how it went!
8+
9+
### ✨ Notable Changes
10+
- Say goodbye to transactions: span streaming is now the default tracing model
11+
- The fine-grained `data_collection` supersedes the flat `send_default_pii`
12+
13+
### 🗞️ Resources
14+
- [2.x to 3.x migration guide](https://docs.sentry.io/platforms/python/migration/2.x-to-3.x)
15+
- [detailed changelog](https://github.com/getsentry/sentry-python/blob/major/3.0/MIGRATION_GUIDE.md)
16+
317
## 3.0.0b3
418

519
This is a pre-release of the next Python SDK major, to be released in November 2026.
@@ -42,6 +56,58 @@ Want to give it a spin? Be our guest and [let us know](https://github.com/getsen
4256
- [2.x to 3.x migration guide](https://docs.sentry.io/platforms/python/migration/2.x-to-3.x)
4357
- [detailed changelog](https://github.com/getsentry/sentry-python/blob/major/3.0/MIGRATION_GUIDE.md)
4458

59+
## 2.74.0
60+
61+
### New Features ✨
62+
63+
#### Anthropic
64+
65+
- Record reasoning parts in streaming output by @alexander-alderman-webb in [#8193](https://github.com/getsentry/sentry-python/pull/8193)
66+
- Record reasoning parts in nonstreaming output by @alexander-alderman-webb in [#8192](https://github.com/getsentry/sentry-python/pull/8192)
67+
68+
#### Other
69+
70+
- (typesafe) Handle inline images by @alexander-alderman-webb in [#8164](https://github.com/getsentry/sentry-python/pull/8164)
71+
72+
### Bug Fixes 🐛
73+
74+
#### Anthropic
75+
76+
- Preserve cached `_iterator` property by @alexander-alderman-webb in [#8163](https://github.com/getsentry/sentry-python/pull/8163)
77+
- Stop unpacking output arrays by @alexander-alderman-webb in [#8160](https://github.com/getsentry/sentry-python/pull/8160)
78+
79+
#### Other
80+
81+
- (aiohttp) Leave existing `baggage` header alone if it has existin… by @pabloDeputter in [#8116](https://github.com/getsentry/sentry-python/pull/8116)
82+
- (boto3) Adapt to botocore no longer signing baggage by @sentrivana in [#8113](https://github.com/getsentry/sentry-python/pull/8113)
83+
- (ci) Restrict pytest because of incompatibilities by @sentrivana in [#8140](https://github.com/getsentry/sentry-python/pull/8140)
84+
- (falcon) Handle integer HTTP statuses by @jap and @sentrivana in [#8139](https://github.com/getsentry/sentry-python/pull/8139)
85+
- (sampling) Respect incoming sample rate if not explicitly overridden by @sentrivana in [#8185](https://github.com/getsentry/sentry-python/pull/8185)
86+
- (tracing) Drop trailing comma when serializing baggage without third-party items by @alphasafal and @pabloDeputter in [#8119](https://github.com/getsentry/sentry-python/pull/8119)
87+
- (wsgi) Stop overwriting `server.address` by @alexander-alderman-webb in [#8171](https://github.com/getsentry/sentry-python/pull/8171)
88+
89+
### Internal Changes 🔧
90+
91+
#### Deps
92+
93+
- Lock file maintenance by @renovate in [#8055](https://github.com/getsentry/sentry-python/pull/8055)
94+
- Bump grpcio to 1.84.1 by @geoffg-sentry with @sentry-junior in [#8136](https://github.com/getsentry/sentry-python/pull/8136)
95+
- Bump uv to 0.13.5 by @geoffg-sentry with @sentry-junior in [#8135](https://github.com/getsentry/sentry-python/pull/8135)
96+
- Bump brotli to 1.2.1 by @geoffg-sentry with @sentry-junior in [#8122](https://github.com/getsentry/sentry-python/pull/8122)
97+
98+
#### Other
99+
100+
- (mcp) Remove unused select_mcp_transactions fixture by @sentrivana with @sentry-junior in [#8150](https://github.com/getsentry/sentry-python/pull/8150)
101+
- (release) Bump craft to 3.9.0 and update config by @BYK with @sentry-junior in [#8181](https://github.com/getsentry/sentry-python/pull/8181)
102+
- (sessions) Remove unused TERMINAL_SESSION_STATES constant by @sentrivana with @sentry-junior in [#8151](https://github.com/getsentry/sentry-python/pull/8151)
103+
- (starlette) Remove unused \_serialize_request_body_data helper by @sentry-junior in [#8146](https://github.com/getsentry/sentry-python/pull/8146)
104+
- (toxgen) Remove unused `get_file_hash()` and `get_last_updated()` helpers by @sentry-junior in [#8173](https://github.com/getsentry/sentry-python/pull/8173)
105+
- (tracing) Remove unused base64_stripped regex by @sentry-junior in [#8148](https://github.com/getsentry/sentry-python/pull/8148)
106+
- (utils) Remove unused to_timestamp helper and epoch constant by @sentry-junior in [#8147](https://github.com/getsentry/sentry-python/pull/8147)
107+
- 🤖 Update test matrix with new releases (11/02) by @sentrivana with @github-actions in [#8172](https://github.com/getsentry/sentry-python/pull/8172)
108+
- Upgrade `sphinx` and remove `packaging` upper bound by @alexander-alderman-webb in [#8183](https://github.com/getsentry/sentry-python/pull/8183)
109+
- Update test matrix with new releases (27/10) by @alexander-alderman-webb in [#8126](https://github.com/getsentry/sentry-python/pull/8126)
110+
45111
## 2.73.0
46112

47113
### New Features ✨

‎MIGRATION_GUIDE.md‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,24 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
4747
- The `RustTracingIntegration` no longer includes the values of tracing fields if `send_default_pii` is enabled. Pass `include_tracing_fields=True` to the integration to include them.
4848
- Whether the Dramatiq integration attaches message bodies to events is now controlled by `data_collection`'s `queues` setting instead of `http_bodies`.
4949
- The Celery integration no longer sets the status of task spans to error when a task raises a control flow exception (`Retry`, `Ignore`, or `Reject`).
50-
- The boto3 integration now names spans `<ServiceID>.<Operation>` (for example, `S3.GetObject` or `DynamoDB.GetItem`), following OpenTelemetry semantic conventions. Previously, spans were named `aws.<service-id>.<Operation>` (for example, `aws.s3.GetObject`). Its spans, including the span for reading a streamed response body, now also have the origin `auto.aws.boto3` instead of `auto.http.boto3`. Update any alerts, dashboards, or `ignore_spans` rules that match on the old names or origin.
50+
- The boto3 integration now names spans `<ServiceID>.<Operation>` (for example, `S3.GetObject` or `DynamoDB.GetItem`), following OpenTelemetry semantic conventions. Previously, spans were named `aws.<service-id>.<Operation>` (for example, `aws.s3.GetObject`). Its spans, including the span for reading a streamed response body, now also have the origin `auto.aws.boto3` instead of `auto.http.boto3`. SQS and SNS messaging calls are the exception: SQS `SendMessage` and `SendMessageBatch` are named `send <queue name>`, `ReceiveMessage` is named `receive <queue name>`, and `DeleteMessage` and `DeleteMessageBatch` are named `settle <queue name>`; SNS `Publish` and `PublishBatch` are named `send <topic name>`. Update any alerts, dashboards, or `ignore_spans` rules that match on the old names or origin.
5151
- Enabling an AI agent integration (LangChain, OpenAI Agents, or Pydantic AI) no longer disables the OpenAI, Anthropic, and Google GenAI integrations. Instead, those integrations don't create chat spans for requests made from within an agent framework's chat span, but still create other spans, such as embedding spans. The LangChain integration no longer instruments embeddings directly; embedding spans are now created by the integration of the underlying client library.
5252
- Whether the MCP integration records tool arguments, tool results, and prompt contents is now controlled by `data_collection`'s new `mcp` setting (`{"inputs": bool, "outputs": bool}`, both `True` by default) instead of the `gen_ai` setting.
5353
- With `handled_tool_call_exceptions=True` (the default), the Pydantic AI integration now reports an error for every failed tool argument validation attempt, including retries. Previously, only one error was reported per tool call.
5454
- The Pydantic AI integration no longer sets the `gen_ai.response.streaming` span attribute.
55+
- The `OTLPIntegration` no longer sets up a propagator by default: `setup_propagator` now defaults to `False`. Distributed tracing now uses the propagators configured in OpenTelemetry (by default, W3C `traceparent` and `baggage`) instead of Sentry's `sentry-trace` and `baggage` headers. To get the old behavior back, set `OTLPIntegration(setup_propagator=True)`. To propagate both W3C and Sentry headers, set up the `SentryOTLPPropagator` manually instead:
56+
57+
```python
58+
from opentelemetry.propagate import set_global_textmap
59+
from opentelemetry.propagators.composite import CompositePropagator
60+
from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
61+
62+
from sentry_sdk.integrations.otlp import SentryOTLPPropagator
63+
64+
set_global_textmap(
65+
CompositePropagator([TraceContextTextMapPropagator(), SentryOTLPPropagator()])
66+
)
67+
```
5568

5669
#### Span operation consolidation
5770

@@ -64,7 +77,7 @@ Span ops are now a smaller, framework-neutral set.
6477
- The Django integration now emits `view.render` instead of `view.response.render`, `view` instead of `view.authenticate`, and `function` instead of `event.django`.
6578
- The Django, Starlette, Starlite, and Litestar integrations now emit `middleware` instead of `middleware.django`, `middleware.starlette`, `middleware.starlette.receive`, `middleware.starlette.send`, `middleware.starlite`, `middleware.starlite.receive`, `middleware.starlite.send`, `middleware.litestar`, `middleware.litestar.receive`, and `middleware.litestar.send`.
6679
- The ARQ, Celery, Django, Dramatiq, Huey, RQ, and Ray integrations now emit `queue.publish` and `queue.process` instead of `queue.submit.arq`, `queue.task.arq`, `queue.submit.celery`, `queue.task.celery`, `queue.submit.django`, `queue.task.dramatiq`, `queue.submit.huey`, `queue.task.huey`, `queue.task.rq`, `queue.submit.ray`, and `queue.task.ray`.
67-
- The Boto3 integration now emits `rpc` instead of `http.client` for AWS API calls.
80+
- The Boto3 integration now emits `rpc` instead of `http.client` for AWS API calls. SQS messaging calls emit `queue.publish` (`SendMessage`, `SendMessageBatch`), `queue.receive` (`ReceiveMessage`), and `queue.settle` (`DeleteMessage`, `DeleteMessageBatch`) instead, and SNS `Publish` and `PublishBatch` emit `queue.publish`.
6881

6982
#### GenAI span attributes
7083

‎docs/conf.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year)
1818
author = "Sentry Team and Contributors"
1919

20-
release = "3.0.0b3"
20+
release = "3.0.0b4"
2121
version = ".".join(release.split(".")[:2]) # The short X.Y version.
2222

2323

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ typing = [
8282
"openai-agents>=0.22.0",
8383
"mistralai>=2.10.1",
8484
"typesafe-sdk>=0.7.5",
85+
"mypy-boto3-bedrock-runtime>=1.43.62",
8586
]
8687
test = [
8788
"dataclasses ; python_full_version < '3.7'",

‎scripts/aws/aws-attach-layer-to-lambda-function.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ echo "Getting ARN of newest Sentry lambda layer..."
2222
LAYER_ARN=$(aws lambda list-layer-versions --layer-name SentryPythonServerlessSDK-local-dev --query "LayerVersions[0].LayerVersionArn" | tr -d '"')
2323
echo "Done getting ARN of newest Sentry lambda layer $LAYER_ARN."
2424

25-
echo "Attaching Lamba layer to function $FUNCTION_NAME..."
25+
echo "Attaching Lambda layer to function $FUNCTION_NAME..."
2626
echo "Warning: This remove all other layers!"
2727
aws lambda update-function-configuration \
2828
--function-name "$FUNCTION_NAME" \
2929
--layers "$LAYER_ARN" \
3030
--no-cli-pager
31-
echo "Done attaching Lamba layer to function '$FUNCTION_NAME'."
31+
echo "Done attaching Lambda layer to function '$FUNCTION_NAME'."
3232

3333
echo "All done. Have a nice day!"

‎scripts/build_aws_lambda_layer.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def install_python_packages(self) -> None:
5656
"pip",
5757
"install",
5858
"--no-cache-dir", # always access PyPI
59-
"--no-deps", # the right depencencies have been installed in the call above
59+
"--no-deps", # the right dependencies have been installed in the call above
6060
"--quiet",
6161
sentry_python_sdk,
6262
"--target",

‎scripts/find_raise_from_none.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def main():
4343
scan_file(module_path)
4444

4545
raise_from_none_count = {
46-
file: len(occurences)
47-
for file, occurences in RaiseFromNoneVisitor.line_numbers.items()
46+
file: len(occurrences)
47+
for file, occurrences in RaiseFromNoneVisitor.line_numbers.items()
4848
}
4949
if raise_from_none_count:
5050
exc = Exception("Detected unexpected raise ... from None.")

‎scripts/init_serverless_sdk.py‎

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
'sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler'
77
"""
88

9+
import importlib
910
import os
10-
import re
11-
import sys
1211
from typing import TYPE_CHECKING
1312

1413
import sentry_sdk
@@ -27,8 +26,6 @@
2726

2827

2928
class AWSLambdaModuleLoader:
30-
DIR_PATH_REGEX = r"^(.+)\/([^\/]+)$"
31-
3229
def __init__(self, sentry_initial_handler):
3330
try:
3431
module_path, self.handler_name = sentry_initial_handler.rsplit(".", 1)
@@ -41,35 +38,24 @@ def extract_and_load_lambda_function_module(self, module_path):
4138
"""
4239
Method that extracts and loads lambda function module from module_path
4340
"""
44-
py_version = sys.version_info
45-
46-
if re.match(self.DIR_PATH_REGEX, module_path):
47-
# With a path like -> `scheduler/scheduler/event`
48-
# `module_name` is `event`, and `module_file_path` is `scheduler/scheduler/event.py`
49-
module_name = module_path.split(os.path.sep)[-1]
50-
module_file_path = module_path + ".py"
51-
52-
# Supported python versions are 3.7, 3.8
53-
if py_version >= (3, 7):
54-
import importlib.util
55-
56-
spec = importlib.util.spec_from_file_location(
57-
module_name, module_file_path
58-
)
59-
self.lambda_function_module = importlib.util.module_from_spec(spec)
60-
spec.loader.exec_module(self.lambda_function_module)
61-
else:
62-
raise ValueError("Python version %s is not supported." % py_version)
63-
else:
64-
import importlib
65-
66-
self.lambda_function_module = importlib.import_module(module_path)
41+
# the handler used to be loaded from a file path, so keep accepting
42+
# `./dir/file` and absolute `<task root>/dir/file` by making them relative
43+
# to the task root, which is on `sys.path`.
44+
task_root = os.environ.get("LAMBDA_TASK_ROOT", os.getcwd())
45+
module_path = os.path.relpath(os.path.join(task_root, module_path), task_root)
46+
47+
# like the Lambda runtime: `dir/file` is the module `dir.file`, which `sys.modules`
48+
# keeps, so its code only runs on the first invocation.
49+
# https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/fa2462d93d11da632aad8f8bfb07a3e060438150/awslambdaric/bootstrap.py#L53
50+
self.lambda_function_module = importlib.import_module(
51+
module_path.replace("/", ".")
52+
)
6753

6854
def get_lambda_handler(self):
6955
return getattr(self.lambda_function_module, self.handler_name)
7056

7157

72-
def sentry_lambda_handler(event: "Any", context: "Any") -> None:
58+
def sentry_lambda_handler(event: "Any", context: "Any") -> "Any":
7359
"""
7460
Handler function that invokes a lambda handler which path is defined in
7561
environment variables as "SENTRY_INITIAL_HANDLER"

‎scripts/populate_tox/config.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@
440440
},
441441
"redis": {
442442
"package": "redis",
443+
"include": "!=8.2.0b1",
443444
"deps": {
444445
"*": ["fakeredis!=1.7.4", "pytest<8.0.0", "pytest-asyncio"],
445446
">=4.0,<5.0": ["fakeredis<2.31.0"],

0 commit comments

Comments
 (0)