Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2e4457c
fix(openai-agents): also emit spans for MCP tool calls done by the LL…
constantinius Oct 2, 2025
ffc88f5
ci: 🤖 Update test matrix with new releases (10/02) (#4880)
github-actions[bot] Oct 2, 2025
b3fe619
Optimize _get_db_span_description
codeflash-ai[bot] Oct 2, 2025
f3e8a5c
fix(tests): Don't assume release is set (#4879)
sentrivana Oct 3, 2025
bbd2a5d
feat(integrations): Add tracing to DramatiqIntegration (#4571)
Igreh Oct 3, 2025
f979abf
feat(integrations): add litellm integration (#4864)
constantinius Oct 3, 2025
39cb2c5
feat(huggingface): Support 1.0.0rc2 (#4873)
sentrivana Oct 6, 2025
8bc1966
ci: 🤖 Update test matrix with new releases (10/06) (#4889)
github-actions[bot] Oct 6, 2025
41f709e
ci: 🤖 Update test matrix with new releases (10/06) (#4890)
github-actions[bot] Oct 6, 2025
bf77a86
fix(litestar): Copy request info to prevent cookies mutation (#4883)
alexander-alderman-webb Oct 6, 2025
91cc2bc
release: 2.40.0
getsentry-bot Oct 6, 2025
070ecd0
Update CHANGELOG.md
sentrivana Oct 6, 2025
04968c4
Add links to CHANGELOG.md
sentrivana Oct 6, 2025
87f8f39
Merge branch 'release/2.40.0'
Oct 6, 2025
a879d82
ci: Remove toxgen check (#4892)
sentrivana Oct 8, 2025
b1dd2dc
fix(ai): add mapping for gen_ai message roles (#4884)
shellmayr Oct 8, 2025
f32e391
feat: Add concurrent.futures patch to threading integration (#4770)
alexander-alderman-webb Oct 8, 2025
55e903e
ci: Bump Python version for linting (#4897)
sentrivana Oct 8, 2025
7997368
chore: Remove old metrics code (#4899)
sentrivana Oct 9, 2025
a049747
ref: Remove "experimental" from log func name (#4901)
sentrivana Oct 9, 2025
1f8c008
feat(metrics): Add trace metrics behind an experiments flag (#4898)
k-fish Oct 9, 2025
272af1b
release: 2.41.0
getsentry-bot Oct 9, 2025
685287d
Update CHANGELOG.md
sentrivana Oct 9, 2025
b7cda42
Merge branch 'release/2.41.0'
Oct 9, 2025
149a7da
feat(ai): Add `python-genai` integration (#4891)
vgrozdanic Oct 10, 2025
97d6756
fix(Ray): Retain the original function name when patching Ray tasks (…
svartalf Oct 10, 2025
f8b9069
tests: Update tox (#4913)
sentrivana Oct 10, 2025
cab17a4
feat: Add source information for slow outgoing HTTP requests (#4902)
alexander-alderman-webb Oct 10, 2025
643d87e
build(deps): bump github/codeql-action from 3 to 4 (#4916)
dependabot[bot] Oct 13, 2025
f99a17b
ci: 🤖 Update test matrix with new releases (10/13) (#4917)
github-actions[bot] Oct 13, 2025
db67178
Merge branch 'master' into codeflash/optimize-_get_db_span_descriptio…
misrasaurabh1 Oct 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,12 @@ jobs:
- uses: actions/[email protected]
- uses: actions/setup-python@v6
with:
python-version: 3.12
python-version: 3.14

- run: |
pip install tox
tox -e linters

check-ci-config:
name: Check CI config
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: 3.12

- name: Detect unexpected changes to tox.ini or CI
run: |
pip install -e .
pip install -r scripts/populate_tox/requirements.txt
python scripts/populate_tox/populate_tox.py --fail-on-changes
pip install -r scripts/split_tox_gh_actions/requirements.txt
python scripts/split_tox_gh_actions/split_tox_gh_actions.py --fail-on-changes

build_lambda_layer:
name: Build Package
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -63,7 +63,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
Expand All @@ -77,4 +77,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
24 changes: 16 additions & 8 deletions .github/workflows/test-integrations-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-cohere"
- name: Test google_genai
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-google_genai"
- name: Test huggingface_hub
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-huggingface_hub"
- name: Test langchain-base
run: |
set -x # print commands that are executed
Expand All @@ -66,6 +74,14 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-langchain-notiktoken"
- name: Test langgraph
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-langgraph"
- name: Test litellm
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-litellm"
- name: Test openai-base
run: |
set -x # print commands that are executed
Expand All @@ -74,18 +90,10 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-openai-notiktoken"
- name: Test langgraph
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-langgraph"
- name: Test openai_agents
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-openai_agents"
- name: Test huggingface_hub
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-huggingface_hub"
- name: Generate coverage XML (Python 3.6)
if: ${{ !cancelled() && matrix.python-version == '3.6' }}
run: |
Expand Down
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# Changelog

## 2.41.0

### Various fixes & improvements

- feat: Add `concurrent.futures` patch to threading integration (#4770) by @alexander-alderman-webb

The SDK now makes sure to automatically preserve span relationships when using `ThreadPoolExecutor`.
- chore: Remove old metrics code (#4899) by @sentrivana

Removed all code related to the deprecated experimental metrics feature (`sentry_sdk.metrics`).
- ref: Remove "experimental" from log function name (#4901) by @sentrivana
- fix(ai): Add mapping for gen_ai message roles (#4884) by @shellmayr
- feat(metrics): Add trace metrics behind an experiments flag (#4898) by @k-fish

## 2.40.0

### Various fixes & improvements

- Add LiteLLM integration (#4864) by @constantinius
Once you've enabled the [new LiteLLM integration](https://docs.sentry.io/platforms/python/integrations/litellm/), you can use the Sentry AI Agents Monitoring, a Sentry dashboard that helps you understand what's going on with your AI requests:

```python
import sentry_sdk
from sentry_sdk.integrations.litellm import LiteLLMIntegration
sentry_sdk.init(
dsn="<your-dsn>",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Add data like inputs and responses;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
LiteLLMIntegration(),
],
)
```

- Litestar: Copy request info to prevent cookies mutation (#4883) by @alexander-alderman-webb
- Add tracing to `DramatiqIntegration` (#4571) by @Igreh
- Also emit spans for MCP tool calls done by the LLM (#4875) by @constantinius
- Option to not trace HTTP requests based on status codes (#4869) by @alexander-alderman-webb
You can now disable transactions for incoming requests with specific HTTP status codes. The [new `trace_ignore_status_codes` option](https://docs.sentry.io/platforms/python/configuration/options/#trace_ignore_status_codes) accepts a `set` of status codes as integers. If a transaction wraps a request that results in one of the provided status codes, the transaction will be unsampled.

```python
import sentry_sdk

sentry_sdk.init(
trace_ignore_status_codes={301, 302, 303, *range(305, 400), 404},
)
```

- Move `_set_agent_data` call to `ai_client_span` function (#4876) by @constantinius
- Add script to determine lowest supported versions (#4867) by @sentrivana
- Update `CONTRIBUTING.md` (#4870) by @sentrivana

## 2.39.0

### Various fixes & improvements
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year)
author = "Sentry Team and Contributors"

release = "2.39.0"
release = "2.41.0"
version = ".".join(release.split(".")[:2]) # The short X.Y version.


Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ ignore_missing_imports = true
module = "langgraph.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "google.genai.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "executing.*"
ignore_missing_imports = true
Expand Down Expand Up @@ -179,6 +183,10 @@ ignore_missing_imports = true
module = "agents.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "dramatiq.*"
ignore_missing_imports = true

#
# Tool: Ruff (linting and formatting)
#
Expand Down
37 changes: 21 additions & 16 deletions scripts/populate_tox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,24 @@ combination of hardcoded and generated entries.

The `populate_tox.py` script fills out the auto-generated part of that template.
It does this by querying PyPI for each framework's package and its metadata and
then determining which versions make sense to test to get good coverage.
then determining which versions it makes sense to test to get good coverage.

By default, the lowest supported and latest version of a framework are always
tested, with a number of releases in between:
- If the package has majors, we pick the highest version of each major.
- If the package doesn't have multiple majors, we pick two versions in between
lowest and highest.

#### Caveats
Each test suite requires at least some configuration to be added to
`TEST_SUITE_CONFIG` in `scripts/populate_tox/config.py`. If you're adding a new
integration, check out the [Add a new test suite](#add-a-new-test-suite) section.

- Make sure the integration name is the same everywhere. If it consists of
multiple words, use an underscore instead of a hyphen.
## Test suite config

## Defining constraints

The `TEST_SUITE_CONFIG` dictionary defines, for each integration test suite,
the main package (framework, library) to test with; any additional test
dependencies, optionally gated behind specific conditions; and optionally
the Python versions to test on.
The `TEST_SUITE_CONFIG` dictionary in `scripts/populate_tox/config.py` defines,
for each integration test suite, the main package (framework, library) to test
with; any additional test dependencies, optionally gated behind specific
conditions; and optionally the Python versions to test on.

Constraints are defined using the format specified below. The following sections
describe each key.
Expand All @@ -58,7 +57,7 @@ in [packaging.specifiers](https://packaging.pypa.io/en/stable/specifiers.html).

### `package`

The name of the third party package as it's listed on PyPI. The script will
The name of the third-party package as it's listed on PyPI. The script will
be picking different versions of this package to test.

This key is mandatory.
Expand All @@ -69,15 +68,15 @@ The test dependencies of the test suite. They're defined as a dictionary of
`rule: [package1, package2, ...]` key-value pairs. All packages
in the package list of a rule will be installed as long as the rule applies.

`rule`s are predefined. Each `rule` must be one of the following:
Each `rule` must be one of the following:
- `*`: packages will be always installed
- a version specifier on the main package (e.g. `<=0.32`): packages will only
be installed if the main package falls into the version bounds specified
- specific Python version(s) in the form `py3.8,py3.9`: packages will only be
installed if the Python version matches one from the list

Rules can be used to specify version bounds on older versions of the main
package's dependencies, for example. If e.g. Flask tests generally need
package's dependencies, for example. If Flask tests generally need
Werkzeug and don't care about its version, but Flask older than 3.0 needs
a specific Werkzeug version to work, you can say:

Expand Down Expand Up @@ -176,7 +175,7 @@ be expressed like so:
### `integration_name`

Sometimes, the name of the test suite doesn't match the name of the integration.
For example, we have the `openai_base` and `openai_notiktoken` test suites, both
For example, we have the `openai-base` and `openai-notiktoken` test suites, both
of which are actually testing the `openai` integration. If this is the case, you
can use the `integration_name` key to define the name of the integration. If not
provided, it will default to the name of the test suite.
Expand All @@ -193,6 +192,11 @@ greater than 2, as the oldest and latest supported versions will always be
picked. Additionally, if there is a recent prerelease, it'll also always be
picked (this doesn't count towards `num_versions`).

For instance, `num_versions` set to `2` will only test the first supported and
the last release of the package. `num_versions` equal to `3` will test the first
supported, the last release, and one release in between; `num_versions` set to `4`
will test an additional release in between. In all these cases, if there is
a recent prerelease, it'll be picked as well in addition to the picked versions.

## How-Tos

Expand All @@ -202,9 +206,10 @@ picked (this doesn't count towards `num_versions`).
in `integrations/__init__.py`. This should be the lowest version of the
framework that we can guarantee works with the SDK. If you've just added the
integration, you should generally set this to the latest version of the framework
at the time.
at the time, unless you've verified the integration works for earlier versions
as well.
2. Add the integration and any constraints to `TEST_SUITE_CONFIG`. See the
"Defining constraints" section for the format.
[Test suite config](#test-suite-config) section for the format.
3. Add the integration to one of the groups in the `GROUPS` dictionary in
`scripts/split_tox_gh_actions/split_tox_gh_actions.py`.
4. Run `scripts/generate-test-files.sh` and commit the changes.
28 changes: 21 additions & 7 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# The TEST_SUITE_CONFIG dictionary defines, for each integration test suite,
# the main package (framework, library) to test with; any additional test
# dependencies, optionally gated behind specific conditions; and optionally
# the Python versions to test on.
# at least the main package (framework, library) to test with. Additional
# test dependencies, Python versions to test on, etc. can also be defined here.
#
# See scripts/populate_tox/README.md for more info on the format and examples.

Expand Down Expand Up @@ -143,6 +142,13 @@
"package": "gql[all]",
"num_versions": 2,
},
"google_genai": {
"package": "google-genai",
"deps": {
"*": ["pytest-asyncio"],
},
"python": ">=3.9",
},
"graphene": {
"package": "graphene",
"deps": {
Expand Down Expand Up @@ -183,9 +189,8 @@
"huggingface_hub": {
"package": "huggingface_hub",
"deps": {
"*": ["responses"],
"*": ["responses", "pytest-httpx"],
},
"include": "<1.0",
},
"langchain-base": {
"package": "langchain",
Expand Down Expand Up @@ -214,6 +219,9 @@
"package": "launchdarkly-server-sdk",
"num_versions": 2,
},
"litellm": {
"package": "litellm",
},
"litestar": {
"package": "litestar",
"deps": {
Expand All @@ -232,7 +240,10 @@
"*": ["pytest-asyncio", "tiktoken"],
"<1.55": ["httpx<0.28"],
},
"python": ">=3.8",
"python": {
">0.0,<2.3": ">=3.8",
">=2.3": ">=3.9",
},
},
"openai-notiktoken": {
"package": "openai",
Expand All @@ -241,7 +252,10 @@
"*": ["pytest-asyncio"],
"<1.55": ["httpx<0.28"],
},
"python": ">=3.8",
"python": {
">0.0,<2.3": ">=3.8",
">=2.3": ">=3.9",
},
},
"openai_agents": {
"package": "openai-agents",
Expand Down
Loading