Skip to content

Commit 104e201

Browse files
Merge branch 'major/3.0' into pablo/boto3-s3-object-ops
2 parents 64bf8c6 + eb34f42 commit 104e201

57 files changed

Lines changed: 10518 additions & 8094 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/changelog-preview.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ permissions:
1515

1616
jobs:
1717
changelog-preview:
18-
uses: getsentry/craft/.github/workflows/changelog-preview.yml@3f2abdc5703191d12ef2cc013f792f1bd220f44d # v2
18+
uses: getsentry/craft/.github/workflows/changelog-preview.yml@7a7857552e2cdc08b502de96e6076849c01fba32 # v2
1919
secrets:
2020
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
token: ${{ steps.token.outputs.token }}
3232
fetch-depth: 0
3333
- name: Prepare release
34-
uses: getsentry/craft@3f2abdc5703191d12ef2cc013f792f1bd220f44d # 2.34.1
34+
uses: getsentry/craft@7a7857552e2cdc08b502de96e6076849c01fba32 # 2.35.0
3535
env:
3636
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
3737
with:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
with:
4242
enable-cache: false
4343
- name: Install Java
44-
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6
44+
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6
4545
with:
4646
distribution: 'temurin'
4747
java-version: '21'

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
uv run coverage combine .coverage-sentry-*
116116
uv run coverage xml
117117
- name: Report coverage and test results
118-
uses: getsentry/coverage-action@88418cdae07a8bac2beaec1550bcafff9ec55c8b # 0.4.3
118+
uses: getsentry/coverage-action@b3db4e382bd9859c913a96093a3d369b67f59177 # 0.4.4
119119
with:
120120
token: ${{ secrets.GITHUB_TOKEN }}
121121
files: coverage.xml

‎AGENTS.md‎

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Agent Instructions
1+
# Working with the Codebase
22

33
## Tox
44

@@ -40,21 +40,61 @@ Do NOT edit these directly — modify source scripts instead:
4040
3. Add to group in `scripts/split_tox_gh_actions/split_tox_gh_actions.py`
4141
4. Run `scripts/generate-test-files.sh`
4242

43-
## Integration Contract
4443

45-
- Don't crash applications or swallow exceptions
46-
- Don't mutate object references or alter function signatures
47-
- Don't leak file descriptors or make unexpected DB requests
48-
- Write defensive code
49-
- Use end-to-end tests (not mocks)
50-
51-
## Key Paths
52-
53-
| Path | Description |
54-
|------|-------------|
55-
| `sentry_sdk/integrations/` | integration modules |
56-
| `sentry_sdk/ai/` | AI monitoring |
57-
| `sentry_sdk/crons/` | Cron monitoring |
58-
| `sentry_sdk/profiler/` | Performance profiling |
59-
| `tests/integrations/{name}/` | Integration test suites |
60-
| `scripts/populate_tox/config.py` | Test suite configuration |
44+
# SDK Implementation Guidelines
45+
46+
## General Guidelines
47+
48+
- Don't crash applications. SDK-caused exceptions should always be handled with `capture_internal_exceptions`.
49+
- Don't swallow exceptions not caused by the SDK. The user's app should behave the same as it would without the SDK. If exceptions would bubble all the way up and crash the app, they should do that.
50+
- Don't submit huge PRs. If a big feature can be meaningfully split into several PRs, split it. If the PRs depend on each other, stack them.
51+
- No side effects. Don't make extra DB or HTTP requests or leak file descriptors.
52+
- The user is instructed to initialize the SDK as early as possible. You may assume this is the case.
53+
54+
## Maintainability & Code Structure
55+
56+
- **Don't fragment code unnecessarily**:
57+
- Only extract code into a function if it's used in multiple places or if it's overly complex and distracts from understanding the flow of the neighboring code.
58+
- Prefer one file over splitting implementation into multiple files. Having to follow the flow of code by jumping through several files is not good style.
59+
- Keep constants at the top of the file, under imports.
60+
- Don't inline imports in functions. Strongly prefer adding imports to the top of the file, on the top level.
61+
62+
## Integration Guidelines
63+
64+
When integrating with a package:
65+
66+
- Prefer the following approaches, in this order of preference:
67+
1) Signals, hooks, callbacks provided by the package
68+
2) Monkeypatching public functions
69+
3) Monkeypatching private functions (the more integral to the package, the better, as they're less likely to change)
70+
4) Other approaches only if the above fails
71+
- A mix of the approaches above is also acceptable.
72+
- **Minimize state.**
73+
- If you need to store state (for instance, a running span), prefer storing it on an object of the package that gets passed around "for free".
74+
- Keeping state manually (e.g., implementing lookup tables) should be a last resort option.
75+
- Write code for the most common usecase. Keep scope small. Features can always be added later, if requested. Don't design for special cases.
76+
- Don't mutate object references or alter function signatures.
77+
- Take into account that packages evolve and change.
78+
- When monkeypatching a function, unless it's public, allow for it changing the order of arguments, or adding an argument, in the future.
79+
```python
80+
# Bad monkeypatching
81+
def patched_func(arg_you_need, another_arg, third_arg):
82+
# Don't spell out all arguments. If a new argument is added or an argument
83+
# we don't use is renamed, the patch breaks.
84+
...
85+
86+
# Good monkeypatching
87+
def patched_func(arg_you_need, *args, **kwargs):
88+
# Only assume the argument you need is there. Leave the rest of the
89+
# arguments flexible, so that we don't break if they change.
90+
...
91+
```
92+
93+
## Test Guidelines
94+
95+
- Don't use mocks unless it can't be avoided.
96+
- Use end-to-end tests, not unit tests.
97+
- Avoid testing integration helpers or private methods directly.
98+
- Avoid testing things that can't realistically break.
99+
- Avoid duplicating tests (extend an existing one or use `parametrize`).
100+
- Assert on what Sentry captures with `capture_events`/`capture_items`.

‎CHANGELOG.md‎

Lines changed: 91 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,87 @@
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+
38+
## 3.0.0b1
39+
40+
This is a pre-release of the next Python SDK major, to be released in November 2026.
41+
42+
Want to give it a spin? Be our guest and [let us know](https://github.com/getsentry/sentry-python/discussions) how it went!
43+
44+
## ✨ Notable Changes
45+
- Say goodbye to transactions: span streaming is now the default tracing model
46+
- The fine-grained `data_collection` supersedes the flat `send_default_pii`
47+
48+
## 🗞️ Resources
49+
- [2.x to 3.x migration guide](https://docs.sentry.io/platforms/python/migration/2.x-to-3.x)
50+
- [detailed changelog](https://github.com/getsentry/sentry-python/blob/major/3.0/MIGRATION_GUIDE.md)
51+
52+
## 2.73.0
53+
54+
### New Features ✨
55+
56+
- (arq) Add an option to monitor arq cron jobs by @wedamija in [#8051](https://github.com/getsentry/sentry-python/pull/8051)
57+
- (huey) Add an option to monitor Huey periodic tasks by @wedamija in [#8052](https://github.com/getsentry/sentry-python/pull/8052)
58+
- (rq) Add an option to monitor rq-scheduler jobs by @wedamija in [#8053](https://github.com/getsentry/sentry-python/pull/8053)
59+
- (types) Export Attributes from the public types module by @sansynx in [#8019](https://github.com/getsentry/sentry-python/pull/8019)
60+
61+
### Bug Fixes 🐛
62+
63+
- (arq) Don't monitor cron jobs with unsupported schedules by @wedamija in [#8098](https://github.com/getsentry/sentry-python/pull/8098)
64+
- (attributes) Handle special float values correctly by @sentrivana in [#8067](https://github.com/getsentry/sentry-python/pull/8067)
65+
- (celery) Don't round down beat schedule intervals by @wedamija in [#7842](https://github.com/getsentry/sentry-python/pull/7842)
66+
- (cohere) Stop swallowing exceptions during stream iteration by @intertermux-code in [#8017](https://github.com/getsentry/sentry-python/pull/8017)
67+
- (huggingface_hub) Stop swallowing exceptions during stream iteration by @intertermux-code in [#8018](https://github.com/getsentry/sentry-python/pull/8018)
68+
- Exclude litellm==1.107.0 from extras by @jonny-norwine in [#8104](https://github.com/getsentry/sentry-python/pull/8104)
69+
70+
### Internal Changes 🔧
71+
72+
#### Deps
73+
74+
- Update github workflows by @renovate in [#8045](https://github.com/getsentry/sentry-python/pull/8045)
75+
- Update github workflows by @renovate in [#8036](https://github.com/getsentry/sentry-python/pull/8036)
76+
- Update github workflows by @renovate in [#7276](https://github.com/getsentry/sentry-python/pull/7276)
77+
78+
#### Other
79+
80+
- (litellm) Require filelock>=4.0.3 on Python 3.10/3.11 by @sentry-junior in [#8026](https://github.com/getsentry/sentry-python/pull/8026)
81+
- (monitor) Stop background health checks in tests that drive the monitor by @sentry-junior in [#8032](https://github.com/getsentry/sentry-python/pull/8032)
82+
- Update `AGENTS.md` by @sentrivana in [#8077](https://github.com/getsentry/sentry-python/pull/8077)
83+
- 🤖 Update test matrix with new releases (10/12) by @github-actions in [#7944](https://github.com/getsentry/sentry-python/pull/7944)
84+
385
## 2.72.0
486

587
### New Features ✨
@@ -147,7 +229,7 @@ sentry_sdk.init(
147229
Offers much more flexibility than `send_default_pii`, allowing you to specify what
148230
data should be collected. If `data_collection` is defined, it takes precedence over
149231
`send_default_pii`.
150-
232+
151233
See https://docs.sentry.io/platforms/python/configuration/options/#data_collection
152234
for the available configuration options.
153235

@@ -752,7 +834,7 @@ Self-hosted Sentry users should opt out with `stream_gen_ai_spans=False`, since
752834
### New Features ✨
753835

754836
- Add integration for `aiomysql` by @tonal in [#4703](https://github.com/getsentry/sentry-python/pull/4703)
755-
837+
756838
We're adding support for the `aiomysql` package. To enable the integration, add it to your `integrations` list:
757839

758840
```python
@@ -775,7 +857,7 @@ Self-hosted Sentry users should opt out with `stream_gen_ai_spans=False`, since
775857
import sentry_sdk
776858

777859
sentry_sdk.init(...)
778-
860+
779861
with sentry_sdk.start_transaction(name="testing_sentry"):
780862
httpx2.get("https://sentry.io/")
781863
```
@@ -831,7 +913,7 @@ Self-hosted Sentry users should opt out with `stream_gen_ai_spans=False`, since
831913

832914
Following a previous significant increase of the string truncation limit, we've now completely removed the limit by default.
833915
In case you have large strings in your events, you should now be able to see them.
834-
916+
835917
In rare cases, if you have really long strings (or a lot of them), you might see envelopes being dropped because of their size.
836918
If that happens, you can set the `max_value_length` `init` option to the previous value of `100_000`:
837919

@@ -1304,17 +1386,17 @@ We've put additional data that might contain sensitive information, like GraphQL
13041386

13051387
```python
13061388
import sentry_sdk
1307-
1389+
13081390
sentry_sdk.init(...)
1309-
1391+
13101392
sentry_sdk.set_attribute("my.attribute", "my value")
1311-
1393+
13121394
# This metric will have "my.attribute" set
13131395
sentry_sdk.metrics.count("counter", 1)
1314-
1396+
13151397
# Remove the attribute
13161398
sentry_sdk.remove_attribute("my.attribute")
1317-
1399+
13181400
# This log will not have "my.attribute" set
13191401
sentry_sdk.logger.info("An info log")
13201402
```

‎MIGRATION_GUIDE.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
1313
- If a `before_breadcrumb` callback, an event processor, or an error processor raises an exception, the breadcrumb or event is now dropped. Previously, the SDK would log the exception and continue processing the unmodified breadcrumb or event.
1414
- The top-level manual tracing API is now wired to span streaming tracing:
1515
- `sentry_sdk.start_transaction` doesn't exist anymore. Use `sentry_sdk.start_span` instead.
16-
- `sentry_sdk.start_span` accepts four arguments now: `name` (mandatory), `attributes`, `parent_span` (default: current active span), `active` (default: `True`).
16+
- `sentry_sdk.start_span` accepts five arguments now: `name` (mandatory), `attributes`, `parent_span` (default: current active span), `active` (default: `True`), `links` (spans to link to without making them the parent; more can be added with `span.add_link()` / `span.add_links()`).
1717
- The `@trace` decorator accepts three optional arguments: `name`, `attributes`, `active` (default: `True`).
1818
- `sentry_sdk.continue_trace` accepts a single dictionary with the incoming headers or environment data. It is no longer a context manager and it does not return a span/transaction anymore. A span needs to be started manually afterwards.
1919
- `sentry_sdk.new_trace` resets the trace.
@@ -252,7 +252,7 @@ Additionally, the OpenAI integration now sets `gen_ai.operation.name` to `chat`
252252
- The `update_current_span` API was removed.
253253
- The `sentry_sdk.tracing` module was removed, including the `Span`, `Transaction`, `NoOpSpan`, and `TransactionSource` classes. Import tracing primitives from `sentry_sdk.traces` instead. `TransactionSource` was replaced by `sentry_sdk.traces.SegmentNameSource`, which has the same values. The span classes from 2.x's span streaming mode, `sentry_sdk.traces.StreamedSpan` and `NoOpStreamedSpan`, are now called `Span` and `NoOpSpan`; the old names remain available as aliases.
254254
- The `stream_gen_ai_spans` option was removed. All spans are streamed now. If you previously set `stream_gen_ai_spans=False`, note that GenAI integrations no longer truncate messages (previously, only the last message was kept and truncated), and the OpenAI, Anthropic, LangChain, LiteLLM, and OpenAI Agents integrations no longer replace binary content in messages (for example, base64-encoded images) with `[Filtered]`. To prevent prompts and responses from being sent, set `data_collection`'s `gen_ai` `inputs` and/or `outputs` to `False`.
255-
- The `trace_lifecycle` option (both top-level and experimental) was removed. Span streaming is now the only tracing mode.
255+
- Span streaming is now the only tracing mode. The experimental `trace_lifecycle` option was removed. The top-level `trace_lifecycle` option is still accepted, but any value other than `"stream"` is ignored and logs a warning.
256256

257257
### Integrations
258258

‎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 = "2.72.0"
34+
release = "3.0.0b2"
3535
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3636

3737

‎scripts/populate_tox/config.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@
449449
# The default "addr" value was removed in https://github.com/cunla/fakeredis-py/commit/0441288fb22c8c191fc716b561e0001cf512abe5.
450450
# from fakeredis.
451451
">=1.1.14": ["fakeredis<2.36.0"],
452+
">=2.0": ["rq-scheduler"],
452453
"<0.9": ["fakeredis<1.0", "redis<3.2.2"],
453454
">=0.9,<0.14": ["fakeredis>=1.0,<1.7.4"],
454455
"py3.7": ["fakeredis!=2.26.0"],

0 commit comments

Comments
 (0)