You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 104e201
Browse filesBrowse the repository at this point in the historyBrowse files
|`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.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+91-9Lines changed: 91 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,87 @@
1
1
# Changelog
2
2
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)
- (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
+
3
85
## 2.72.0
4
86
5
87
### New Features ✨
@@ -147,7 +229,7 @@ sentry_sdk.init(
147
229
Offers much more flexibility than `send_default_pii`, allowing you to specify what
148
230
data should be collected. If `data_collection` is defined, it takes precedence over
149
231
`send_default_pii`.
150
-
232
+
151
233
See https://docs.sentry.io/platforms/python/configuration/options/#data_collection
152
234
for the available configuration options.
153
235
@@ -752,7 +834,7 @@ Self-hosted Sentry users should opt out with `stream_gen_ai_spans=False`, since
752
834
### New Features ✨
753
835
754
836
- Add integration for `aiomysql` by @tonal in [#4703](https://github.com/getsentry/sentry-python/pull/4703)
755
-
837
+
756
838
We're adding support for the `aiomysql` package. To enable the integration, add it to your `integrations` list:
757
839
758
840
```python
@@ -775,7 +857,7 @@ Self-hosted Sentry users should opt out with `stream_gen_ai_spans=False`, since
775
857
import sentry_sdk
776
858
777
859
sentry_sdk.init(...)
778
-
860
+
779
861
with sentry_sdk.start_transaction(name="testing_sentry"):
780
862
httpx2.get("https://sentry.io/")
781
863
```
@@ -831,7 +913,7 @@ Self-hosted Sentry users should opt out with `stream_gen_ai_spans=False`, since
831
913
832
914
Following a previous significant increase of the string truncation limit, we've now completely removed the limit by default.
833
915
In case you have large strings in your events, you should now be able to see them.
834
-
916
+
835
917
In rare cases, if you have really long strings (or a lot of them), you might see envelopes being dropped because of their size.
836
918
If that happens, you can set the `max_value_length` `init` option to the previous value of `100_000`:
837
919
@@ -1304,17 +1386,17 @@ We've put additional data that might contain sensitive information, like GraphQL
1304
1386
1305
1387
```python
1306
1388
import sentry_sdk
1307
-
1389
+
1308
1390
sentry_sdk.init(...)
1309
-
1391
+
1310
1392
sentry_sdk.set_attribute("my.attribute", "my value")
Copy file name to clipboardExpand all lines: MIGRATION_GUIDE.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
13
13
- 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.
14
14
- The top-level manual tracing API is now wired to span streaming tracing:
15
15
-`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()`).
17
17
- The `@trace` decorator accepts three optional arguments: `name`, `attributes`, `active` (default: `True`).
18
18
-`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.
19
19
-`sentry_sdk.new_trace` resets the trace.
@@ -252,7 +252,7 @@ Additionally, the OpenAI integration now sets `gen_ai.operation.name` to `chat`
252
252
- The `update_current_span` API was removed.
253
253
- 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.
254
254
- 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.
0 commit comments