Skip to content

Commit 0266db9

Browse files
Merge branch 'major/3.0' into pablo/boto3-add-lambda-extension
2 parents ae57d8b + ca07d0d commit 0266db9

10 files changed

Lines changed: 167 additions & 53 deletions

File tree

‎CHANGELOG.md‎

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

3+
## 3.0.0b2
4+
5+
### New Features ✨
6+
7+
- (arq) Add an option to monitor arq cron jobs by @wedamija in [#8051](https://github.com/getsentry/sentry-python/pull/8051)
8+
- (huey) Add an option to monitor Huey periodic tasks by @wedamija in [#8052](https://github.com/getsentry/sentry-python/pull/8052)
9+
- (rq) Add an option to monitor rq-scheduler jobs by @wedamija in [#8053](https://github.com/getsentry/sentry-python/pull/8053)
10+
11+
### Bug Fixes 🐛
12+
13+
- (aiohttp) Leave existing `baggage` header alone if it has existin… by @pabloDeputter in [#8116](https://github.com/getsentry/sentry-python/pull/8116)
14+
- (arq) Don't monitor cron jobs with unsupported schedules by @wedamija in [#8098](https://github.com/getsentry/sentry-python/pull/8098)
15+
- (attributes) Handle special float values correctly by @sentrivana in [#8067](https://github.com/getsentry/sentry-python/pull/8067)
16+
- (boto3) Adapt to botocore no longer signing baggage by @sentrivana in [#8113](https://github.com/getsentry/sentry-python/pull/8113)
17+
- (celery) Don't round down beat schedule intervals by @wedamija in [#7842](https://github.com/getsentry/sentry-python/pull/7842)
18+
- Exclude litellm==1.107.0 from extras by @jonny-norwine in [#8104](https://github.com/getsentry/sentry-python/pull/8104)
19+
20+
### Internal Changes 🔧
21+
22+
#### Deps
23+
24+
- Bump brotli to 1.2.1 by @sentry-junior in [#8122](https://github.com/getsentry/sentry-python/pull/8122)
25+
- Update github workflows by @renovate in [#8045](https://github.com/getsentry/sentry-python/pull/8045)
26+
- Update github workflows by @renovate in [#8036](https://github.com/getsentry/sentry-python/pull/8036)
27+
28+
#### Other
29+
30+
- (monitor) Stop background health checks in tests that drive the monitor by @sentry-junior in [#8032](https://github.com/getsentry/sentry-python/pull/8032)
31+
- Update `AGENTS.md` by @sentrivana in [#8077](https://github.com/getsentry/sentry-python/pull/8077)
32+
33+
### Other
34+
35+
- Next Python SDK major by @sentrivana in [#5005](https://github.com/getsentry/sentry-python/pull/5005)
36+
- Testing merge by @sentrivana in [#8115](https://github.com/getsentry/sentry-python/pull/8115)
37+
338
## 3.0.0b1
439

540
This is a pre-release of the next Python SDK major, to be released in November 2026.

‎docs/conf.py‎

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

34-
release = "3.0.0b1"
34+
release = "3.0.0b2"
3535
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3636

3737

‎sentry_sdk/consts.py‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,16 @@ class OP:
15071507
HUGGINGFACE_HUB_CHAT_COMPLETIONS_CREATE = (
15081508
"ai.chat_completions.create.huggingface_hub"
15091509
)
1510+
OBJECT_COPY = "object.copy"
1511+
OBJECT_DELETE = "object.delete"
1512+
OBJECT_GET = "object.get"
1513+
OBJECT_HEAD = "object.head"
1514+
OBJECT_LIST = "object.list"
1515+
OBJECT_MULTIPART_UPLOAD_ABORT = "object.multipart_upload.abort"
1516+
OBJECT_MULTIPART_UPLOAD_COMPLETE = "object.multipart_upload.complete"
1517+
OBJECT_MULTIPART_UPLOAD_CREATE = "object.multipart_upload.create"
1518+
OBJECT_PUT = "object.put"
1519+
OBJECT_UPLOAD_PART = "object.upload_part"
15101520
QUEUE_PROCESS = "queue.process"
15111521
QUEUE_PUBLISH = "queue.publish"
15121522
QUEUE_SUBMIT_ARQ = "queue.submit.arq"
@@ -2014,4 +2024,4 @@ def _get_default_options() -> "dict[str, Any]":
20142024
del _get_default_options
20152025

20162026

2017-
VERSION = "3.0.0b1"
2027+
VERSION = "3.0.0b2"

‎sentry_sdk/integrations/aiohttp.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
SpanStatus,
2929
)
3030
from sentry_sdk.tracing_utils import (
31+
Baggage,
3132
add_http_breadcrumb,
3233
add_http_request_source,
3334
should_propagate_trace,
@@ -343,6 +344,19 @@ async def on_request_start(
343344
if SENTRY_TRACE_HEADER_NAME in params.headers:
344345
headers_to_skip.add(SENTRY_TRACE_HEADER_NAME)
345346

347+
# `baggage` with Sentry members (e.g. merged by the boto3 integration
348+
# before signing): skip so Sentry members are not duplicated.
349+
with capture_internal_exceptions():
350+
baggage = params.headers.get(BAGGAGE_HEADER_NAME)
351+
if baggage:
352+
if isinstance(baggage, bytes):
353+
baggage = baggage.decode("latin-1")
354+
if any(
355+
Baggage.SENTRY_PREFIX_REGEX.match(item.strip())
356+
for item in baggage.split(",")
357+
):
358+
headers_to_skip.add(BAGGAGE_HEADER_NAME)
359+
346360
with capture_internal_exceptions():
347361
authorization = params.headers.get("Authorization")
348362
if authorization:

‎sentry_sdk/integrations/boto3/_services/s3.py‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from datetime import datetime
33
from typing import TYPE_CHECKING
44

5-
from sentry_sdk.consts import SPANDATA
5+
from sentry_sdk.consts import OP, SPANDATA
66
from sentry_sdk.integrations.boto3._services.base import _ServiceExtension
77
from sentry_sdk.integrations.boto3._utils import (
88
_extract_attributes,
@@ -11,14 +11,36 @@
1111
from sentry_sdk.utils import capture_internal_exceptions
1212

1313
if TYPE_CHECKING:
14-
from typing import Any, Sequence
14+
from typing import Any, Dict, Optional, Sequence
1515

1616
from sentry_sdk._types import Attributes
1717
from sentry_sdk.integrations.boto3._context import AwsCallContext
1818
from sentry_sdk.integrations.boto3._utils import (
1919
_AttributeSpec,
2020
)
2121

22+
# s3 object apis get `object.*` ops, every other s3 api, e.g. `ListBuckets`, keeps the default `rpc`.
23+
# https://github.com/getsentry/sentry-conventions/blob/main/model/op/object.json
24+
_OBJECT_OPS: "Dict[str, str]" = {
25+
"GetObject": OP.OBJECT_GET,
26+
"HeadObject": OP.OBJECT_HEAD,
27+
# `GetObjectAttributes` combines `HeadObject` and `ListParts`.
28+
# https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAttributes.html
29+
"GetObjectAttributes": OP.OBJECT_HEAD,
30+
"PutObject": OP.OBJECT_PUT,
31+
"CopyObject": OP.OBJECT_COPY,
32+
"DeleteObject": OP.OBJECT_DELETE,
33+
"DeleteObjects": OP.OBJECT_DELETE,
34+
"ListObjects": OP.OBJECT_LIST,
35+
"ListObjectsV2": OP.OBJECT_LIST,
36+
"ListObjectVersions": OP.OBJECT_LIST,
37+
"UploadPart": OP.OBJECT_UPLOAD_PART,
38+
"UploadPartCopy": OP.OBJECT_UPLOAD_PART,
39+
"CreateMultipartUpload": OP.OBJECT_MULTIPART_UPLOAD_CREATE,
40+
"CompleteMultipartUpload": OP.OBJECT_MULTIPART_UPLOAD_COMPLETE,
41+
"AbortMultipartUpload": OP.OBJECT_MULTIPART_UPLOAD_ABORT,
42+
}
43+
2244
# maps s3 operations to the response field that contains the complete file size.
2345
_RESPONSE_FILE_SIZE_FIELDS = {
2446
"GetObjectAttributes": "ObjectSize",
@@ -36,6 +58,9 @@
3658
class _S3Extension(_ServiceExtension):
3759
__slots__ = ()
3860

61+
def get_span_op(self, ctx: "AwsCallContext") -> "Optional[str]":
62+
return _OBJECT_OPS.get(ctx.operation_name)
63+
3964
def get_request_attributes(self, ctx: "AwsCallContext") -> "Attributes":
4065
attributes: "Attributes" = _extract_attributes(ctx.params, _REQUEST_ATTRIBUTES)
4166
with capture_internal_exceptions():

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_file_text(file_name):
2222

2323
setup(
2424
name="sentry-sdk",
25-
version="3.0.0b1",
25+
version="3.0.0b2",
2626
author="Sentry Team and Contributors",
2727
author_email="hello@sentry.io",
2828
url="https://github.com/getsentry/sentry-python",

‎tests/integrations/aiohttp/test_aiohttp.py‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,21 @@ async def handler(request):
743743

744744

745745
@pytest.mark.asyncio
746-
async def test_outgoing_trace_headers_preserves_signed_propagation_headers(
747-
sentry_init, aiohttp_raw_server, aiohttp_client
746+
@pytest.mark.parametrize(
747+
"signed_headers,baggage",
748+
[
749+
# both propagation headers are named in `SignedHeaders`.
750+
("baggage;host;sentry-trace", "vendor=value"),
751+
# botocore 1.43.115+ never signs `baggage`; Sentry members were merged by
752+
# the boto3 integration before signing.
753+
(
754+
"host;sentry-trace",
755+
"vendor=value,sentry-trace_id=existing,sentry-sampled=true",
756+
),
757+
],
758+
)
759+
async def test_outgoing_trace_headers_preserves_existing_propagation_headers(
760+
sentry_init, aiohttp_raw_server, aiohttp_client, signed_headers, baggage
748761
):
749762
sentry_init(
750763
integrations=[AioHttpIntegration()],
@@ -755,11 +768,10 @@ async def handler(request):
755768
return web.Response(text="OK")
756769

757770
raw_server = await aiohttp_raw_server(handler)
758-
# both propagation headers are named in `SignedHeaders`.
759771
authorization = (
760772
"AWS4-HMAC-SHA256 "
761773
"Credential=test/20260804/eu-west-1/secretsmanager/aws4_request, "
762-
"SignedHeaders=baggage;host;sentry-trace, "
774+
f"SignedHeaders={signed_headers}, "
763775
"Signature=sixtyseven"
764776
)
765777

@@ -768,15 +780,15 @@ async def handler(request):
768780
resp = await client.get(
769781
"/",
770782
headers={
771-
"baggage": "vendor=value",
783+
"baggage": baggage,
772784
"sentry-trace": "existing-trace",
773785
"Authorization": authorization,
774786
},
775787
)
776788

777789
headers = resp.request_info.headers
778-
# signed `baggage`: leave as-is.
779-
assert headers["baggage"] == "vendor=value"
790+
# signed `baggage` or `baggage` with Sentry members: leave as-is.
791+
assert headers["baggage"] == baggage
780792
# signed `sentry-trace`: leave as-is.
781793
assert headers["sentry-trace"] == "existing-trace"
782794

0 commit comments

Comments
 (0)