Skip to content

Commit ca81e0b

Browse files
authored
Merge branch 'master' into ivana/starlette-tests-with-uvicorn
2 parents e15edf5 + 4bec867 commit ca81e0b

Some content is hidden

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

49 files changed

+2869
-230
lines changed

.github/workflows/test-integrations-data-processing.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
- name: Erase coverage
4343
run: |
4444
coverage erase
45+
- name: Test anthropic latest
46+
run: |
47+
set -x # print commands that are executed
48+
./scripts/runtox.sh "py${{ matrix.python-version }}-anthropic-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
4549
- name: Test arq latest
4650
run: |
4751
set -x # print commands that are executed
@@ -54,14 +58,26 @@ jobs:
5458
run: |
5559
set -x # print commands that are executed
5660
./scripts/runtox.sh "py${{ matrix.python-version }}-celery-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
61+
- name: Test cohere latest
62+
run: |
63+
set -x # print commands that are executed
64+
./scripts/runtox.sh "py${{ matrix.python-version }}-cohere-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
5765
- name: Test huey latest
5866
run: |
5967
set -x # print commands that are executed
6068
./scripts/runtox.sh "py${{ matrix.python-version }}-huey-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
69+
- name: Test langchain latest
70+
run: |
71+
set -x # print commands that are executed
72+
./scripts/runtox.sh "py${{ matrix.python-version }}-langchain-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
6173
- name: Test openai latest
6274
run: |
6375
set -x # print commands that are executed
6476
./scripts/runtox.sh "py${{ matrix.python-version }}-openai-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
77+
- name: Test huggingface_hub latest
78+
run: |
79+
set -x # print commands that are executed
80+
./scripts/runtox.sh "py${{ matrix.python-version }}-huggingface_hub-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
6581
- name: Test rq latest
6682
run: |
6783
set -x # print commands that are executed
@@ -98,6 +114,10 @@ jobs:
98114
- name: Erase coverage
99115
run: |
100116
coverage erase
117+
- name: Test anthropic pinned
118+
run: |
119+
set -x # print commands that are executed
120+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-anthropic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
101121
- name: Test arq pinned
102122
run: |
103123
set -x # print commands that are executed
@@ -110,14 +130,26 @@ jobs:
110130
run: |
111131
set -x # print commands that are executed
112132
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
133+
- name: Test cohere pinned
134+
run: |
135+
set -x # print commands that are executed
136+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-cohere" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
113137
- name: Test huey pinned
114138
run: |
115139
set -x # print commands that are executed
116140
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
141+
- name: Test langchain pinned
142+
run: |
143+
set -x # print commands that are executed
144+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-langchain" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
117145
- name: Test openai pinned
118146
run: |
119147
set -x # print commands that are executed
120148
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-openai" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
149+
- name: Test huggingface_hub pinned
150+
run: |
151+
set -x # print commands that are executed
152+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-huggingface_hub" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
121153
- name: Test rq pinned
122154
run: |
123155
set -x # print commands that are executed

CHANGELOG.md

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

3+
## 2.2.0
4+
5+
### New features
6+
7+
- Celery integration now sends additional data to Sentry to enable new features to guage the health of your queues
8+
- Added a new integration for Cohere
9+
- Reintroduced the `last_event_id` function, which had been removed in 2.0.0
10+
11+
### Other fixes & improvements
12+
13+
- Add tags + data passing functionality to @ai_track (#3071) by @colin-sentry
14+
- fix(tracing): Only propagate headers from spans within transactions (#3070) by @szokeasaurusrex
15+
- ref(metrics): Improve type hints for set metrics (#3048) by @elramen
16+
- ref(scope): Fix `get_client` typing (#3063) by @szokeasaurusrex
17+
- Auto-enable Anthropic integration + gate imports (#3054) by @colin-sentry
18+
- Made MeasurementValue.unit NotRequired (#3051) by @antonpirker
19+
20+
## 2.1.1
21+
22+
- Fix trace propagation in Celery tasks started by Celery Beat. (#3047) by @antonpirker
23+
24+
## 2.1.0
25+
26+
- fix(quart): Fix Quart integration (#3043) by @szokeasaurusrex
27+
28+
- **New integration:** [Langchain](https://docs.sentry.io/platforms/python/integrations/langchain/) (#2911) by @colin-sentry
29+
30+
Usage: (Langchain is auto enabling, so you do not need to do anything special)
31+
```python
32+
from langchain_openai import ChatOpenAI
33+
import sentry_sdk
34+
35+
sentry_sdk.init(
36+
dsn="...",
37+
enable_tracing=True,
38+
traces_sample_rate=1.0,
39+
)
40+
41+
llm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0)
42+
```
43+
44+
Check out [the LangChain docs](https://docs.sentry.io/platforms/python/integrations/langchain/) for details.
45+
46+
- **New integration:** [Anthropic](https://docs.sentry.io/platforms/python/integrations/anthropic/) (#2831) by @czyber
47+
48+
Usage: (add the AnthropicIntegration to your `sentry_sdk.init()` call)
49+
```python
50+
from anthropic import Anthropic
51+
52+
import sentry_sdk
53+
54+
sentry_sdk.init(
55+
dsn="...",
56+
enable_tracing=True,
57+
traces_sample_rate=1.0,
58+
integrations=[AnthropicIntegration()],
59+
)
60+
61+
client = Anthropic()
62+
```
63+
Check out [the Anthropic docs](https://docs.sentry.io/platforms/python/integrations/anthropic/) for details.
64+
65+
- **New integration:** [Huggingface Hub](https://docs.sentry.io/platforms/python/integrations/huggingface/) (#3033) by @colin-sentry
66+
67+
Usage: (Huggingface Hub is auto enabling, so you do not need to do anything special)
68+
69+
```python
70+
import sentry_sdk
71+
from huggingface_hub import InferenceClient
72+
73+
sentry_sdk.init(
74+
dsn="...",
75+
enable_tracing=True,
76+
traces_sample_rate=1.0,
77+
)
78+
79+
client = InferenceClient("some-model")
80+
```
81+
82+
Check out [the Huggingface docs](https://docs.sentry.io/platforms/python/integrations/huggingface/) for details. (comming soon!)
83+
84+
- fix(huggingface): Reduce API cross-section for huggingface in test (#3042) by @colin-sentry
85+
- fix(django): Fix Django ASGI integration on Python 3.12 (#3027) by @bellini666
86+
- feat(perf): Add ability to put measurements directly on spans. (#2967) by @colin-sentry
87+
- fix(tests): Fix trytond tests (#3031) by @sentrivana
88+
- fix(tests): Update `pytest-asyncio` to fix CI (#3030) by @sentrivana
89+
- fix(docs): Link to respective migration guides directly (#3020) by @sentrivana
90+
- docs(scope): Add docstring to `Scope.set_tags` (#2978) by @szokeasaurusrex
91+
- test(scope): Fix typos in assert error message (#2978) by @szokeasaurusrex
92+
- feat(scope): New `set_tags` function (#2978) by @szokeasaurusrex
93+
- test(scope): Add unit test for `Scope.set_tags` (#2978) by @szokeasaurusrex
94+
- feat(scope): Add `set_tags` to top-level API (#2978) by @szokeasaurusrex
95+
- test(scope): Add unit test for top-level API `set_tags` (#2978) by @szokeasaurusrex
96+
- feat(tests): Parallelize tox (#3025) by @sentrivana
97+
- build(deps): Bump checkouts/data-schemas from `4aa14a7` to `4381a97` (#3028) by @dependabot
98+
- meta(license): Bump copyright year (#3029) by @szokeasaurusrex
99+
3100
## 2.0.1
4101

5102
### Various fixes & improvements

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Functional Software, Inc. dba Sentry
3+
Copyright (c) 2018-2024 Functional Software, Inc. dba Sentry
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

checkouts/data-schemas

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year)
2929
author = "Sentry Team and Contributors"
3030

31-
release = "2.0.1"
31+
release = "2.2.0"
3232
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3333

3434

mypy.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ warn_unused_ignores = True
2525
;
2626
; Do not use wildcards in module paths, otherwise added modules will
2727
; automatically have the same set of relaxed rules as the rest
28-
28+
[mypy-cohere.*]
29+
ignore_missing_imports = True
2930
[mypy-django.*]
3031
ignore_missing_imports = True
3132
[mypy-pyramid.*]
@@ -36,6 +37,8 @@ ignore_missing_imports = True
3637
ignore_missing_imports = True
3738
[mypy-aiohttp.*]
3839
ignore_missing_imports = True
40+
[mypy-anthropic.*]
41+
ignore_missing_imports = True
3942
[mypy-sanic.*]
4043
ignore_missing_imports = True
4144
[mypy-tornado.*]
@@ -48,6 +51,8 @@ ignore_missing_imports = True
4851
ignore_missing_imports = True
4952
[mypy-asgiref.*]
5053
ignore_missing_imports = True
54+
[mypy-langchain_core.*]
55+
ignore_missing_imports = True
5156
[mypy-executing.*]
5257
ignore_missing_imports = True
5358
[mypy-asttokens.*]
@@ -69,6 +74,8 @@ ignore_missing_imports = True
6974
ignore_missing_imports = True
7075
[mypy-openai.*]
7176
ignore_missing_imports = True
77+
[mypy-huggingface_hub.*]
78+
ignore_missing_imports = True
7279
[mypy-arq.*]
7380
ignore_missing_imports = True
7481
[mypy-grpc.*]

scripts/aws_lambda_functions/sentryPythonDeleteTestFunctions/lambda_function.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import boto3
2-
import sentry_sdk
2+
import sentry_sdk
33

44

55
monitor_slug = "python-sdk-aws-lambda-tests-cleanup"
66
monitor_config = {
77
"schedule": {
88
"type": "crontab",
9-
"value": "0 12 * * 0", # 12 o'clock on Sunday
9+
"value": "0 12 * * 0", # 12 o'clock on Sunday
1010
},
1111
"timezone": "UTC",
1212
"checkin_margin": 2,
@@ -24,7 +24,7 @@ def delete_lambda_functions(prefix="test_"):
2424
"""
2525
client = boto3.client("lambda", region_name="us-east-1")
2626
functions_deleted = 0
27-
27+
2828
functions_paginator = client.get_paginator("list_functions")
2929
for functions_page in functions_paginator.paginate():
3030
for func in functions_page["Functions"]:
@@ -39,17 +39,17 @@ def delete_lambda_functions(prefix="test_"):
3939
print(f"Got exception: {ex}")
4040

4141
return functions_deleted
42-
42+
4343

4444
def lambda_handler(event, context):
4545
functions_deleted = delete_lambda_functions()
46-
46+
4747
sentry_sdk.metrics.gauge(
48-
key="num_aws_functions_deleted",
48+
key="num_aws_functions_deleted",
4949
value=functions_deleted,
5050
)
51-
51+
5252
return {
53-
'statusCode': 200,
54-
'body': f"{functions_deleted} AWS Lambda functions deleted successfully."
53+
"statusCode": 200,
54+
"body": f"{functions_deleted} AWS Lambda functions deleted successfully.",
5555
}

scripts/runtox.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ if [ -z "${ENV}" ]; then
4040
exit 0
4141
fi
4242

43-
exec $TOXPATH -p all -o -e "$ENV" -- "${@:2}"
43+
exec $TOXPATH -p auto -o -e "$ENV" -- "${@:2}"

scripts/split-tox-gh-actions/split-tox-gh-actions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@
6666
"gcp",
6767
],
6868
"Data Processing": [
69+
"anthropic",
6970
"arq",
7071
"beam",
7172
"celery",
73+
"cohere",
7274
"huey",
75+
"langchain",
7376
"openai",
77+
"huggingface_hub",
7478
"rq",
7579
],
7680
"Databases": [

sentry_sdk/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"get_traceparent",
3434
"is_initialized",
3535
"isolation_scope",
36+
"last_event_id",
3637
"new_scope",
3738
"push_scope",
3839
"set_context",

0 commit comments

Comments
 (0)