8000 Merge branch 'master' into devenv-requirements · getsentry/sentry-python@d0fc8e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit d0fc8e8

Browse files
authored
Merge branch 'master' into devenv-requirements
2 parents 28eff62 + b742c45 commit d0fc8e8

File tree

93 files changed

+2377
-630
lines changed

Some content is hidden

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

93 files changed

+2377
-630
lines changed

.craft.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ targets:
88
pypi:sentry-sdk:
99
- name: github
1010
- name: aws-lambda-layer
11-
includeNames: /^sentry-python-serverless-\d+(\.\d+)*\.zip$/
11+
# This regex that matches the version is taken from craft:
12+
# https://github.com/getsentry/craft/blob/8d77c38ddbe4be59f98f61b6e42952ca087d3acd/src/utils/version.ts#L11
13+
includeNames: /^sentry-python-serverless-\bv?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-?([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+([\da-z-]+(?:\.[\da-z-]+)*))?\b.zip$/
1214
layerName: SentryPythonServerlessSDK
1315
compatibleRuntimes:
1416
- name: python

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
force:
1010
description: Force a release even when there are release-blockers (optional)
1111
required: false
12+
merge_target:
13+
description: Target branch to merge into. Uses the default branch as a fallback (optional)
14+
required: false
1215

1316
jobs:
1417
release:
@@ -26,3 +29,4 @@ jobs:
2629
with:
2730
version: ${{ github.event.inputs.version }}
2831
force: ${{ github.event.inputs.force }}
32+
merge_target: ${{ github.event.inputs.merge_target }}

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
python-version: ["3.5","3.7","3.8","3.11","3.12"]
28+
python-version: ["3.5","3.7","3.8","3.9","3.11","3.12"]
2929
# python3.6 reached EOL and is no longer being supported on
3030
# new versions of hosted runners on Github Actions
3131
# ubuntu-20.04 is the last version that supported python3.6
@@ -58,6 +58,10 @@ jobs:
5858
run: |
5959
set -x # print commands that are executed
6060
./scripts/runtox.sh "py${{ matrix.python-version }}-huey-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
61+
- name: Test openai latest
62+
run: |
63+
set -x # print commands that are executed
64+
./scripts/runtox.sh "py${{ matrix.python-version }}-openai-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
6165
- name: Test rq latest
6266
run: |
6367
set -x # print commands that are executed
@@ -110,6 +114,10 @@ jobs:
110114
run: |
111115
set -x # print commands that are executed
112116
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
117+
- name: Test openai pinned
118+
run: |
119+
set -x # print commands that are executed
120+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-openai" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
113121
- name: Test rq pinned
114122
run: |
115123
set -x # print commands that are executed
@@ -151,6 +159,10 @@ jobs:
151159
run: |
152160
set -x # print commands that are executed
153161
./scripts/runtox.sh --exclude-latest "py2.7-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
162+
- name: Test openai py27
163+
run: |
164+
set -x # print commands that are executed
165+
./scripts/runtox.sh --exclude-latest "py2.7-openai" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
154166
- name: Test rq py27
155167
run: |
156168
set -x # print commands that are executed

CHANGELOG.md

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

3+
## 1.43.0
4+
5+
### Various fixes & improvements
6+
7+
- Add optional `keep_alive` (#2842) by @sentrivana
8+
9+
If you're experiencing frequent network issues between the SDK and Sentry,
10+
you can try turning on TCP keep-alive:
11+
12+
```python
13+
import sentry_sdk
14+
15+
sentry_sdk.init(
16+
# ...your usual settings...
17+
keep_alive=True,
18+
)
19+
```
20+
21+
- Add support for Celery Redbeat cron tasks (#2643) by @kwigley
22+
23+
The SDK now supports the Redbeat scheduler in addition to the default
24+
Celery Beat scheduler for auto instrumenting crons. See
25+
[the docs](https://docs.sentry.io/platforms/python/integrations/celery/crons/)
26+
for more information about how to set this up.
27+
28+
- `aws_event` can be an empty list (#2849) by @sentrivana
29+
- Re-export `Event` in `types.py` (#2829) by @szokeasaurusrex
30+
- Small API docs improvement (#2828) by @antonpirker
31+
- Fixed OpenAI tests (#2834) by @antonpirker
32+
- Bump `checkouts/data-schemas` from `ed078ed` to `8232f17` (#2832) by @dependabot
33+
34+
## 1.42.0
35+
36+
### Various fixes & improvements
37+
38+
- **New integration:** [OpenAI integration](https://docs.sentry.io/platforms/python/integrations/openai/) (#2791) by @colin-sentry
39+
40+
We added an integration for OpenAI to capture errors and also performance data when using the OpenAI Python SDK.
41+
42+
Useage:
43+
44+
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.
45+
46+
```python
47+
from openai import OpenAI
48+
49+
import sentry_sdk
50+
51+
sentry_sdk.init(
52+
dsn="___PUBLIC_DSN___",
53+
enable_tracing=True,
54+
traces_sample_rate=1.0,
55+
)
56+
57+
client = OpenAI()
58+
```
59+
60+
For more information, see the documentation for [OpenAI integration](https://docs.sentry.io/platforms/python/integrations/openai/).
61+
62+
- Discard open OpenTelemetry spans after 10 minutes (#2801) by @antonpirker
63< 10000 code class="diff-text syntax-highlighted-line addition">+
- Propagate sentry-trace and baggage headers to Huey tasks (#2792) by @cnschn
64+
- Added Event type (#2753) by @szokeasaurusrex
65+
- Improve scrub_dict typing (#2768) by @szokeasaurusrex
66+
- Dependencies: bump types-protobuf from 4.24.0.20240302 to 4.24.0.20240311 (#2797) by @dependabot
67+
68+
## 1.41.0
69+
70+
### Various fixes & improvements
71+
72+
- Add recursive scrubbing to `EventScrubber` (#2755) by @Cheapshot003
73+
74+
By default, the `EventScrubber` will not search your events for potential
75+
PII recursively. With this release, you can enable this behavior with:
76+
77+
```python
78+
import sentry_sdk
79+
from sentry_sdk.scrubber import EventScrubber
80+
81+
sentry_sdk.init(
82+
# ...your usual settings...
83+
event_scrubber=EventScrubber(recursive=True),
84+
)
85+
```
86+
87+
- Expose `socket_options` (#2786) by @sentrivana
88+
89+
If the SDK is experiencing connection issues (connection resets, server
90+
closing connection without response, etc.) while sending events to Sentry,
91+
tweaking the default `urllib3` socket options to the following can help:
92+
93+
```python
94+
import socket
95+
from urllib3.connection import HTTPConnection
96+
import sentry_sdk
97+
98+
sentry_sdk.init(
99+
# ...your usual settings...
100+
socket_options=HTTPConnection.default_socket_options + [
101+
(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
102+
# note: skip the following line if you're on MacOS since TCP_KEEPIDLE doesn't exist there
103+
(socket.SOL_TCP, socket.TCP_KEEPIDLE, 45),
104+
(socket.SOL_TCP, socket.TCP_KEEPINTVL, 10),
105+
(socket.SOL_TCP, socket.TCP_KEEPCNT, 6),
106+
],
107+
)
108+
```
109+
110+
- Allow to configure merge target for releases (#2777) by @sentrivana
111+
- Allow empty character in metric tags values (#2775) by @viglia
112+
- Replace invalid tag values with an empty string instead of _ (#2773) by @markushi
113+
- Add documentation comment to `scrub_list` (#2769) by @szokeasaurusrex
114+
- Fixed regex to parse version in lambda package file (#2767) by @antonpirker
115+
- xfail broken AWS Lambda tests for now (#2794) by @sentrivana
116+
- Removed print statements because it messes with the tests (#2789) by @antonpirker
117+
- Bump `types-protobuf` from 4.24.0.20240129 to 4.24.0.20240302 (#2782) by @dependabot
118+
- Bump `checkouts/data-schemas` from `eb941c2` to `ed078ed` (#2781) by @dependabot
119+
120+
## 1.40.6
121+
122+
### Various fixes & improvements
123+
124+
- Fix compatibility with `greenlet`/`gevent` (#2756) by @sentrivana
125+
- Fix query source relative filepath (#2717) by @gggritso
126+
- Support `clickhouse-driver==0.2.7` (#2752) by @sentrivana
127+
- Bump `checkouts/data-schemas` from `6121fd3` to `eb941c2` (#2747) by @dependabot
128+
3129
## 1.40.5
4130

5131
### Various fixes & improvements

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ lint: .venv
5151
apidocs: .venv
5252
@$(VENV_PATH)/bin/pip install --editable .
5353
@$(VENV_PATH)/bin/pip install -U -r ./docs-requirements.txt
54+
rm -rf docs/_build
5455
@$(VENV_PATH)/bin/sphinx-build -vv -W -b html docs/ docs/_build
5556
.PHONY: apidocs
5657

docs/conf.py

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

33-
release = "1.40.5"
33+
release = "1.43.0"
3434
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3535

3636

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.20240129 # 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.

mypy.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ ignore_missing_imports = True
6767
ignore_missing_imports = True
6868
[mypy-huey.*]
6969
ignore_missing_imports = True
70+
[mypy-openai.*]
71+
ignore_missing_imports = True
7072
[mypy-arq.*]
7173
ignore_missing_imports = True
7274
[mypy-grpc.*]

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"beam",
7171
"celery",
7272
"huey",
73+
"openai",
7374
"rq",
7475
],
7576
"Databases": [

0 commit comments

Comments
 (0)
0