Skip to content

Commit 5ad8412

Browse files
Merge branch 'master' into webb/concurrent-integration-scopes-only
2 parents 1c5cc93 + 87f8f39 commit 5ad8412

File tree

102 files changed

+2285
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2285
-575
lines changed

.coveragerc36

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
[run]
55
branch = true
6-
omit =
6+
omit =
77
/tmp/*
88
*/tests/*
99
*/.venv/*
1010

1111

1212
[report]
13-
exclude_lines =
13+
exclude_lines =
1414
if TYPE_CHECKING:

.cursor/rules/core-architecture.mdc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
description:
3-
globs:
2+
description:
3+
globs:
44
alwaysApply: false
55
---
66
# Core Architecture

.cursor/rules/integrations-guide.mdc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
description:
3-
globs:
2+
description:
3+
globs:
44
alwaysApply: false
55
---
66
# Integrations Guide
@@ -133,10 +133,10 @@ from sentry_sdk.integrations import Integration
133133

134134
class MyIntegration(Integration):
135135
identifier = "my_integration"
136-
136+
137137
def __init__(self, param=None):
138138
self.param = param
139-
139+
140140
@staticmethod
141141
def setup_once():
142142
# Install hooks, monkey patches, etc.

.cursor/rules/project-overview.mdc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
description:
3-
globs:
2+
description:
3+
globs:
44
alwaysApply: false
55
---
66
# Sentry Python SDK - Project Overview

.cursor/rules/quick-reference.mdc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
description:
3-
globs:
2+
description:
3+
globs:
44
alwaysApply: false
55
---
66
# Quick Reference
@@ -44,7 +44,7 @@ tox -e py3.12-django-v5.2.3
4444

4545
### Code Quality
4646

47-
Our `linters` tox environment runs `black` for formatting, `flake8` for linting and `mypy` for type checking.
47+
Our `linters` tox environment runs `ruff-format` for formatting, `ruff-check` for linting and `mypy` for type checking.
4848

4949
```bash
5050
tox -e linters

.cursor/rules/testing-guide.mdc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
description:
3-
globs:
2+
description:
3+
globs:
44
alwaysApply: false
55
---
66
# Testing Guide
@@ -65,10 +65,10 @@ def test_flask_integration(sentry_init, capture_events):
6565
# Test setup
6666
sentry_init(integrations=[FlaskIntegration()])
6767
events = capture_events()
68-
68+
6969
# Test execution
7070
# ... test code ...
71-
71+
7272
# Assertions
7373
assert len(events) == 1
7474
assert events[0]["exception"]["values"][0]["type"] == "ValueError"

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Formatting commits to ignore in git blame
2+
afea4a017bf13f78e82f725ea9d6a56a8e02cb34
3+
23a340a9dca60eea36de456def70c00952a33556

.github/workflows/test-integrations-ai.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ jobs:
6666
run: |
6767
set -x # print commands that are executed
6868
./scripts/runtox.sh "py${{ matrix.python-version }}-langchain-notiktoken"
69+
- name: Test litellm
70+
run: |
71+
set -x # print commands that are executed
72+
./scripts/runtox.sh "py${{ matrix.python-version }}-litellm"
6973
- name: Test openai-base
7074
run: |
7175
set -x # print commands that are executed

.pre-commit-config.yaml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,9 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
4+
- repo: https://github.com/astral-sh/ruff-pre-commit
5+
rev: v0.13.2
66
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
10-
- repo: https://github.com/psf/black
11-
rev: 24.1.0
12-
hooks:
13-
- id: black
14-
exclude: ^(.*_pb2.py|.*_pb2_grpc.py)
15-
16-
- repo: https://github.com/pycqa/flake8
17-
rev: 5.0.4
18-
hooks:
19-
- id: flake8
20-
additional_dependencies:
21-
[
22-
flake8-pyproject,
23-
flake8-bugbear,
24-
pep8-naming,
25-
]
26-
27-
# Disabled for now, because it lists a lot of problems.
28-
#- repo: https://github.com/pre-commit/mirrors-mypy
29-
# rev: 'v0.931'
30-
# hooks:
31-
# - id: mypy
7+
- id: ruff-check
8+
args: [--fix]
9+
- id: ruff-format

CHANGELOG.md

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

3+
## 2.40.0
4+
5+
### Various fixes & improvements
6+
7+
- Add LiteLLM integration (#4864) by @constantinius
8+
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:
9+
10+
```python
11+
import sentry_sdk
12+
from sentry_sdk.integrations.litellm import LiteLLMIntegration
13+
sentry_sdk.init(
14+
dsn="<your-dsn>",
15+
# Set traces_sample_rate to 1.0 to capture 100%
16+
# of transactions for tracing.
17+
traces_sample_rate=1.0,
18+
# Add data like inputs and responses;
19+
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
20+
send_default_pii=True,
21+
integrations=[
22+
LiteLLMIntegration(),
23+
],
24+
)
25+
```
26+
27+
- Litestar: Copy request info to prevent cookies mutation (#4883) by @alexander-alderman-webb
28+
- Add tracing to `DramatiqIntegration` (#4571) by @Igreh
29+
- Also emit spans for MCP tool calls done by the LLM (#4875) by @constantinius
30+
- Option to not trace HTTP requests based on status codes (#4869) by @alexander-alderman-webb
31+
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.
32+
33+
```python
34+
import sentry_sdk
35+
36+
sentry_sdk.init(
37+
trace_ignore_status_codes={301, 302, 303, *range(305, 400), 404},
38+
)
39+
```
40+
41+
- Move `_set_agent_data` call to `ai_client_span` function (#4876) by @constantinius
42+
- Add script to determine lowest supported versions (#4867) by @sentrivana
43+
- Update `CONTRIBUTING.md` (#4870) by @sentrivana
44+
345
## 2.39.0
446

547
### Various fixes & improvements

0 commit comments

Comments
 (0)