Skip to content

Commit bf2e01c

Browse files
authored
Merge branch 'master' into fix/scrub-top-level-array-request-body
2 parents 5443414 + 7fd0934 commit bf2e01c

103 files changed

Lines changed: 7802 additions & 4853 deletions

File tree

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-ai.yml‎

Lines changed: 9 additions & 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.8","3.9","3.10","3.11","3.12","3.13","3.14","3.14t"]
20+
python-version: ["3.8","3.9","3.10","3.11","3.12","3.13","3.14","3.14t","3.15","3.15t"]
2121
os: [ubuntu-22.04]
2222
env:
2323
# 3.6/3.7 run in the python:X.Y container; tell uv to use that system Python.
@@ -57,6 +57,10 @@ jobs:
5757
run: |
5858
set -x # print commands that are executed
5959
./scripts/runtox.sh "py${{ matrix.python-version }}-litellm"
60+
- name: Test mistral
61+
run: |
62+
set -x # print commands that are executed
63+
./scripts/runtox.sh "py${{ matrix.python-version }}-mistral"
6064
- name: Test openai-base
6165
run: |
6266
set -x # print commands that are executed
@@ -65,6 +69,10 @@ jobs:
6569
run: |
6670
set -x # print commands that are executed
6771
./scripts/runtox.sh "py${{ matrix.python-version }}-openai-notiktoken"
72+
- name: Test typesafe
73+
run: |
74+
set -x # print commands that are executed
75+
./scripts/runtox.sh "py${{ matrix.python-version }}-typesafe"
6876
- name: Upload coverage data
6977
if: ${{ !cancelled() }}
7078
continue-on-error: true

‎CHANGELOG.md‎

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

3+
## 2.71.0
4+
5+
### New Features ✨
6+
7+
- **New integration:** TypeSafe (#4733) by @alexander-alderman-webb
8+
9+
Add the TypeSafe integration to your `sentry_sdk.init` call:
10+
11+
```python
12+
import sentry_sdk
13+
from sentry_sdk.integrations.typesafe import TypeSafeIntegration
14+
15+
sentry_sdk.init(
16+
dsn="...",
17+
traces_sample_rate=1.0,
18+
integrations=[
19+
TypeSafeIntegration(),
20+
]
21+
)
22+
```
23+
24+
#### Typesafe
25+
26+
- Record `gen_ai.output.messages` by @alexander-alderman-webb in [#7720](https://github.com/getsentry/sentry-python/pull/7720)
27+
- Set token usage attributes by @alexander-alderman-webb in [#7719](https://github.com/getsentry/sentry-python/pull/7719)
28+
- Record `gen_ai.input.messages` by @alexander-alderman-webb in [#7718](https://github.com/getsentry/sentry-python/pull/7718)
29+
- Record `gen_ai.response.model` by @alexander-alderman-webb in [#7717](https://github.com/getsentry/sentry-python/pull/7717)
30+
- Add integration with `system_one()` patches by @alexander-alderman-webb in [#7716](https://github.com/getsentry/sentry-python/pull/7716)
31+
32+
### Bug Fixes 🐛
33+
34+
- Keep event if processor raises by @sentrivana in [#7701](https://github.com/getsentry/sentry-python/pull/7701)
35+
- Isolate user callbacks, emit client reports by @sentrivana in [#7692](https://github.com/getsentry/sentry-python/pull/7692)
36+
37+
### Documentation 📚
38+
39+
- Promote `data_collection` in changelog by @sentrivana in [#7565](https://github.com/getsentry/sentry-python/pull/7565)
40+
41+
### Internal Changes 🔧
42+
43+
- (aws-lambda) Add `.gitignore` to lambda handlers by @pabloDeputter in [#7638](https://github.com/getsentry/sentry-python/pull/7638)
44+
- (litellm) Set `LITELLM_LOCAL_MODEL_COST_MAP=true` by @alexander-alderman-webb in [#7630](https://github.com/getsentry/sentry-python/pull/7630)
45+
- (otlp) Adjust to `OTLPSpanExporter._headers` removal by @alexander-alderman-webb in [#7722](https://github.com/getsentry/sentry-python/pull/7722)
46+
- Use top-level flush API in tests by @sentrivana in [#7725](https://github.com/getsentry/sentry-python/pull/7725)
47+
- Unsample on sampler exception by @sentrivana in [#7723](https://github.com/getsentry/sentry-python/pull/7723)
48+
- Use `sentry_init` fixture by @sentrivana in [#7577](https://github.com/getsentry/sentry-python/pull/7577)
49+
50+
## 2.70.0
51+
52+
### New Features ✨
53+
54+
- **New integration:** Mistral AI (#4733) by @alexander-alderman-webb
55+
56+
Add the Mistral integration to your `sentry_sdk.init` call:
57+
58+
```python
59+
import sentry_sdk
60+
from sentry_sdk.integrations.mistral import MistralIntegration
61+
62+
sentry_sdk.init(
63+
dsn="...",
64+
traces_sample_rate=1.0,
65+
integrations=[
66+
MistralIntegration(),
67+
]
68+
)
69+
```
70+
71+
- **New option:** A fine-grained way to configure what data should be sent from the SDK.
72+
73+
Offers much more flexibility than `send_default_pii`, allowing you to specify what
74+
data should be collected. If `data_collection` is defined, it takes precedence over
75+
`send_default_pii`.
76+
77+
See https://docs.sentry.io/platforms/python/configuration/options/#data_collection
78+
for the available configuration options.
79+
80+
```python
81+
import sentry_sdk
82+
83+
sentry_sdk.init(
84+
data_collection={
85+
"user_info": False,
86+
"gen_ai": {"inputs": False, "outputs": False},
87+
"graphql": {"document": False, "variables": False},
88+
"database_query_data": False,
89+
"queues": False,
90+
"http_bodies": [],
91+
"cookies": {
92+
"mode": "denylist",
93+
"terms": ["forwarded", "-ip", "remote-", "via", "-user"],
94+
},
95+
"http_headers": {
96+
"request": {
97+
"mode": "denylist",
98+
"terms": ["forwarded", "-ip", "remote-", "via", "-user"],
99+
},
100+
},
101+
"url_query_params": {
102+
"mode": "denylist",
103+
"terms": ["forwarded", "-ip", "remote-", "via", "-user"],
104+
},
105+
}
106+
)
107+
```
108+
109+
#### Mistral
110+
111+
- Record `gen_ai.output.messages` by @alexander-alderman-webb in [#7549](https://github.com/getsentry/sentry-python/pull/7549)
112+
- Record `gen_ai.input.messages` by @alexander-alderman-webb in [#7548](https://github.com/getsentry/sentry-python/pull/7548)
113+
- Record `gen_ai.system_instructions` by @alexander-alderman-webb in [#7547](https://github.com/getsentry/sentry-python/pull/7547)
114+
- Record request parameters by @alexander-alderman-webb in [#7531](https://github.com/getsentry/sentry-python/pull/7531)
115+
- Record token usage by @alexander-alderman-webb in [#7529](https://github.com/getsentry/sentry-python/pull/7529)
116+
- Add integration with `Chat.complete` and `Chat.complete_async` patches by @alexander-alderman-webb in [#7528](https://github.com/getsentry/sentry-python/pull/7528)
117+
118+
### Internal Changes 🔧
119+
120+
- (data-collection) Promote `data_collection` from `_experiments` o top-level by @ericapisani in [#7560](https://github.com/getsentry/sentry-python/pull/7560)
121+
- Close client on teardown by @alexander-alderman-webb in [#7562](https://github.com/getsentry/sentry-python/pull/7562)
122+
- 🤖 Update test matrix with new releases (09/21) by @github-actions in [#7546](https://github.com/getsentry/sentry-python/pull/7546)
123+
- Remove `getsentry/testing-ai-sdk-integrations` by @alexander-alderman-webb in [#7526](https://github.com/getsentry/sentry-python/pull/7526)
124+
3125
## 2.69.2
4126

5127
### Bug Fixes 🐛

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

3737

‎pyproject.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ typing = [
8080
"tiktoken>=0.14.0",
8181
"aiohttp>=3.14.3",
8282
"openai-agents>=0.22.0",
83+
"mistralai>=2.10.1",
84+
"typesafe-sdk>=0.7.2",
8385
]
8486
test = [
8587
"dataclasses ; python_full_version < '3.7'",

‎scripts/populate_tox/config.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@
312312
"*": ["pytest-asyncio", "httpx"],
313313
},
314314
},
315+
"mistral": {
316+
"package": "mistralai",
317+
"deps": {
318+
"*": ["pytest-asyncio", "httpx"],
319+
},
320+
},
315321
"fastmcp": {
316322
"package": "fastmcp",
317323
"deps": {
@@ -555,6 +561,13 @@
555561
"package": "typer",
556562
"num_versions": 2,
557563
},
564+
"typesafe": {
565+
"package": "typesafe-sdk",
566+
"integration_name": "typesafe",
567+
"deps": {
568+
"*": ["pytest-asyncio"],
569+
},
570+
},
558571
"unleash": {
559572
"package": "UnleashClient",
560573
"num_versions": 2,

‎scripts/populate_tox/package_dependencies.jsonl‎

Lines changed: 85 additions & 143 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/populate_tox/releases.jsonl‎

Lines changed: 1 addition & 245 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/populate_tox/tox.jinja‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ setenv =
227227
# which targets the workspace `.venv` instead of the tox env and hangs.
228228
ray: RAY_ENABLE_UV_RUN_RUNTIME_ENV=0
229229
230+
litellm: LITELLM_LOCAL_MODEL_COST_MAP=true
231+
230232
# Avoid polluting test suite with imports
231233
common: PYTEST_ADDOPTS="--ignore=tests/test_shadowed_module.py"
232234
gevent: PYTEST_ADDOPTS="--ignore=tests/test_shadowed_module.py"

‎scripts/split_tox_gh_actions/split_tox_gh_actions.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@
9292
"google_genai",
9393
"huggingface_hub",
9494
"litellm",
95+
"mistral",
9596
"openai-base",
9697
"openai-notiktoken",
98+
"typesafe",
9799
],
98100
"Cloud": [
99101
"aws_lambda",

‎sentry_sdk/_types.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,14 @@ class ToolCallPart(TypedDict):
481481
name: NotRequired[str]
482482
arguments: NotRequired[Any]
483483

484+
class InputMessage(TypedDict):
485+
role: Literal["user", "assistant", "tool"]
486+
parts: list[Union[TextPart, ReasoningPart, ToolCallPart]]
487+
488+
class OutputMessage(TypedDict):
489+
role: Literal["assistant"]
490+
parts: list[Union[TextPart, ReasoningPart]]
491+
484492
class ToolDefinition(TypedDict):
485493
type: str
486494
name: NotRequired[str]

0 commit comments

Comments
 (0)