Skip to content

Commit 260dc53

Browse files
committed
Merge branch 'master' into sentry-sdk-2.0
2 parents f5c9c0c + 16d25e2 commit 260dc53

File tree

4 files changed

+42
-14
lines changed

4 files changed

+42
-14
lines changed

CHANGELOG.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Your existing implementation:
2222
```python
2323
transaction = sentry_sdk.transaction(...)
24-
24+
2525
# later in the code execution:
2626

2727
with sentry_sdk.configure_scope() as scope:
@@ -31,7 +31,7 @@
3131
needs to be changed to this:
3232
```python
3333
transaction = sentry_sdk.transaction(...)
34-
34+
3535
# later in the code execution:
3636

3737
scope = sentry_sdk.Scope.get_current_scope()
@@ -83,18 +83,39 @@
8383
- Passing a function to `sentry_sdk.init`'s `transport` keyword argument has been deprecated. If you wish to provide a custom transport, please pass a `sentry_sdk.transport.Transport` instance or a subclass.
8484
- The parameter `propagate_hub` in `ThreadingIntegration()` was deprecated and renamed to `propagate_scope`.
8585

86+
## 1.42.0
87+
8688
### Various fixes & improvements
8789

88-
- Expose `socket_options` (#2786) by @sentrivana
89-
- AWS Lambda: xfail broken tests for now (#2794) by @sentrivana
90-
- Docs: Add gRPC note to migration guide (a03108f5) by @sentrivana
91-
- Pin `grpcio` versions in CI (#2776) by @arr-ee
92-
- Dependencies: bump types-protobuf from 4.24.0.20240129 to 4.24.0.20240302 (#2782) by @dependabot
93-
- Dependencies: bump checkouts/data-schemas from `eb941c2` to `ed078ed` (#2781) by @dependabot
94-
- Removed print statements because it messes with the tests (#2789) by @antonpirker
95-
- Type hinting for start_transaction kwargs (#2796) by @szokeasaurusrex
96-
- Correct `use_scope` comment (#2790) by @szokeasaurusrex
97-
- Fixed bump-version.sh to work with version names that have chars in them (0a65f388) by @antonpirker
90+
- **New integration:** [OpenAI integration](https://docs.sentry.io/platforms/python/integrations/openai/) (#2791) by @colin-sentry
91+
92+
We added an integration for OpenAI to capture errors and also performance data when using the OpenAI Python SDK.
93+
94+
Useage:
95+
96+
This integrations is auto-enabling, so if you have the `openai` package in your project it will be enabled. Just initialize Sentry before you create your OpenAI client.
97+
98+
```python
99+
from openai import OpenAI
100+
101+
import sentry_sdk
102+
103+
sentry_sdk.init(
104+
dsn="___PUBLIC_DSN___",
105+
enable_tracing=True,
106+
traces_sample_rate=1.0,
107+
)
108+
109+
client = OpenAI()
110+
```
111+
112+
For more information, see the documentation for [OpenAI integration](https://docs.sentry.io/platforms/python/integrations/openai/).
113+
114+
- Discard open OpenTelemetry spans after 10 minutes (#2801) by @antonpirker
115+
- Propagate sentry-trace and baggage headers to Huey tasks (#2792) by @cnschn
116+
- Added Event type (#2753) by @szokeasaurusrex
117+
- Improve scrub_dict typing (#2768) by @szokeasaurusrex
118+
- Dependencies: bump types-protobuf from 4.24.0.20240302 to 4.24.0.20240311 (#2797) by @dependabot
98119

99120
## 1.41.0
100121

linter-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mypy
22
black
33
flake8==5.0.4 # flake8 depends on pyflakes>=3.0.0 and this dropped support for Python 2 "# type:" comments
44
types-certifi
5-
types-protobuf==4.24.0.20240302 # newer raises an error on mypy sentry_sdk
5+
types-protobuf==4.24.0.20240311 # newer raises an error on mypy sentry_sdk
66
types-redis
77
types-setuptools
88
pymongo # There is no separate types module.

sentry_sdk/scrubber.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ def scrub_dict(self, d):
9494
return
9595

9696
for k, v in d.items():
97-
if isinstance(k, str) and k.lower() in self.denylist:
97+
# The cast is needed because mypy is not smart enough to figure out that k must be a
98+
# string after the isinstance check.
99+
if isinstance(k, str) and cast(str, k).lower() in self.denylist:
98100
d[k] = AnnotatedValue.substituted_because_contains_sensitive_data()
99101
elif self.recursive:
100102
self.scrub_dict(v) # no-op unless v is a dict

tox.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ envlist =
149149
{py3.9,py3.11,py3.12}-openai-latest
150150
{py3.9,py3.11,py3.12}-openai-notiktoken
151151

152+
# OpenAI
153+
{py3.9,py3.11,py3.12}-openai-v1
154+
{py3.9,py3.11,py3.12}-openai-latest
155+
{py3.9,py3.11,py3.12}-openai-notiktoken
156+
152157
# OpenTelemetry (OTel)
153158
{py3.7,py3.9,py3.11,py3.12}-opentelemetry
154159

0 commit comments

Comments
 (0)