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

Skip to content

Commit b80a55c

Browse files
Merge branch 'master' into potel-base
2 parents 3936502 + 19c4069 commit b80a55c

31 files changed

+1585
-255
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
---
44

5-
## General Notes
5+
Thank you for contributing to `sentry-python`! Please add tests to validate your changes, and lint your code using `tox -e linters`.
66

7-
Thank you for contributing to `sentry-python`!
8-
9-
Please add tests to validate your changes, and lint your code using `tox -e linters`.
10-
11-
Running the test suite on your PR might require maintainer approval. Some tests (AWS Lambda) additionally require a maintainer to add a special label to run and will fail if the label is not present.
12-
13-
#### For maintainers
14-
15-
Sensitive test suites require maintainer review to ensure that tests do not compromise our secrets. This review must be repeated after any code revisions.
16-
17-
Before running sensitive test suites, please carefully check the PR. Then, apply the `Trigger: tests using secrets` label. The label will be removed after any code changes to enforce our policy requiring maintainers to review all code revisions before running sensitive tests.
7+
Running the test suite on your PR might require maintainer approval. The AWS Lambda tests additionally require a maintainer to add a special label, and they will fail until this label is added.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ jobs:
5757
run: |
5858
set -x # print commands that are executed
5959
./scripts/runtox.sh "py${{ matrix.python-version }}-celery-latest"
60+
- name: Test dramatiq latest
61+
run: |
62+
set -x # print commands that are executed
63+
./scripts/runtox.sh "py${{ matrix.python-version }}-dramatiq-latest"
6064
- name: Test huey latest
6165
run: |
6266
set -x # print commands that are executed
@@ -125,6 +129,10 @@ jobs:
125129
run: |
126130
set -x # print commands that are executed
127131
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-celery"
132+
- name: Test dramatiq pinned
133+
run: |
134+
set -x # print commands that are executed
135+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-dramatiq"
128136
- name: Test huey pinned
129137
run: |
130138
set -x # print commands that are executed

.github/workflows/test-integrations-web-frameworks-2.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ jobs:
5959
run: |
6060
set -x # print commands that are executed
6161
./scripts/runtox.sh "py${{ matrix.python-version }}-falcon-latest"
62+
- name: Test litestar latest
63+
run: |
64+
set -x # print commands that are executed
65+
./scripts/runtox.sh "py${{ matrix.python-version }}-litestar-latest"
6266
- name: Test pyramid latest
6367
run: |
6468
set -x # print commands that are executed
@@ -137,6 +141,10 @@ jobs:
137141
run: |
138142
set -x # print F438 commands that are executed
139143
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-falcon"
144+
- name: Test litestar pinned
145+
run: |
146+
set -x # print commands that are executed
147+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-litestar"
140148
- name: Test pyramid pinned
141149
run: |
142150
set -x # print commands that are executed

CHANGELOG.md

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

3+
## 2.12.0
4+
5+
### Various fixes & improvements
6+
7+
- API: Expose the scope getters to top level API and use them everywhere (#3357) by @sl0thentr0py
8+
- API: `push_scope` deprecation warning (#3355) (#3355) by @szokeasaurusrex
9+
- API: Replace `push_scope` (#3353, #3354) by @szokeasaurusrex
10+
- API: Deprecate, avoid, or stop using `configure_scope` (#3348, #3349, #3350, #3351) by @szokeasaurusrex
11+
- OTel: Remove experimental autoinstrumentation (#3239) by @sentrivana
12+
- Graphene: Add span for grapqhl operation (#2788) by @czyber
13+
- AI: Add async support for `ai_track` decorator (#3376) by @czyber
14+
- CI: Workaround bug preventing Django test runs (#3371) by @szokeasaurusrex
15+
- CI: Remove Django setuptools pin (#3378) by @szokeasaurusrex
16+
- Tests: Test with Django 5.1 RC (#3370) by @sentrivana
17+
- Broaden `add_attachment` type (#3342) by @szokeasaurusrex
18+
- Add span data to the transactions trace context (#3374) by @antonpirker
19+
- Gracefully fail attachment path not found case (#3337) by @sl0thentr0py
20+
- Document attachment parameters (#3342) by @szokeasaurusrex
21+
- Bump checkouts/data-schemas from `0feb234` to `6d2c435` (#3369) by @dependabot
22+
- Bump checkouts/data-schemas from `88273a9` to `0feb234` (#3252) by @dependabot
23+
324
## 2.11.0
425

526
### Various fixes & improvements

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
<p align="center">
2-
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3-
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4-
</a>
5-
</p>
1+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
2+
<img src="https://sentry-brand.storage.googleapis.com/github-banners/github-sdk-python.png" alt="Sentry for Python">
3+
</a>
64

7-
_Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us [<kbd>**Check out our open positions**</kbd>](https://sentry.io/careers/)_
5+
_Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us, [<kbd>**check out our open positions**</kbd>](https://sentry.io/careers/)_.
86

97
# Official Sentry SDK for Python
108

@@ -111,4 +109,4 @@ Licensed under the MIT license, see [`LICENSE`](LICENSE)
111109

112110
<a href="https://github.com/getsentry/sentry-python/graphs/contributors">
113111
<img src="https://contributors-img.web.app/image?repo=getsentry/sentry-python" />
114-
</a>
112+
</a>

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.11.0"
31+
release = "2.12.0"
3232
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3333

3434

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"arq",
8181
"beam",
8282
"celery",
83+
"dramatiq",
8384
"huey",
8485
"rq",
8586
"spark",
@@ -115,6 +116,7 @@
115116
"asgi",
116117
"bottle",
117118
"falcon",
119+
"litestar",
118120
"pyramid",
119121
"quart",
120122
"sanic",

sentry_sdk/_types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
if TYPE_CHECKING:
12-
from collections.abc import Container, MutableMapping
12+
from collections.abc import Container, MutableMapping, Sequence
1313

1414
from datetime import datetime
1515

@@ -25,6 +25,11 @@
2525
from typing import Union
2626
from typing_extensions import Literal, TypedDict
2727

28+
class SDKInfo(TypedDict):
29+
name: str
30+
version: str
31+
packages: Sequence[Mapping[str, str]]
32+
2833
# "critical" is an alias of "fatal" recognized by Relay
2934
LogLevelStr = Literal["fatal", "critical", "error", "warning", "info", "debug"]
3035

sentry_sdk/client.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
from collections.abc import Mapping
66
from datetime import datetime, timezone
77
from importlib import import_module
8+
from typing import cast
89

910
from sentry_sdk._compat import PY37, check_uwsgi_thread_support
1011
from sentry_sdk.utils import (
1112
capture_internal_exceptions,
1213
current_stacktrace,
13-
disable_capture_event,
1414
format_timestamp,
1515
get_sdk_name,
1616
get_type_name,
@@ -53,7 +53,7 @@
5353
from typing import Type
5454
from typing import Union
5555

56-
from sentry_sdk._types import Event, Hint
56+
from sentry_sdk._types import Event, Hint, SDKInfo
5757
from sentry_sdk.integrations import Integration
5858
from sentry_sdk.metrics import MetricsAggregator
5959
from sentry_sdk.scope import Scope
@@ -68,7 +68,7 @@
6868
"name": "sentry.python", # SDK name will be overridden after integrations have been loaded with sentry_sdk.integrations.setup_integrations()
6969
"version": VERSION,
7070
"packages": [{"name": "pypi:sentry-sdk", "version": VERSION}],
71-
}
71+
} # type: SDKInfo
7272

7373

7474
def _get_options(*args, **kwargs):
@@ -386,6 +386,7 @@ def _capture_envelope(envelope):
386386
try:
387387
setup_continuous_profiler(
388388
self.options,
389+
sdk_info=SDK_INFO,
389390
capture_func=_capture_envelope,
390391
)
391392
except Exception as e:
@@ -519,10 +520,13 @@ def _prepare_event(
519520
# Postprocess the event here so that annotated types do
520521
# generally not surface in before_send
521522
if event is not None:
522-
event = serialize(
523-
event,
524-
max_request_body_size=self.options.get("max_request_body_size"),
525-
max_value_length=self.options.get("max_value_length"),
523+
event = cast(
524+
"Event",
525+
serialize(
526+
cast("Dict[str, Any]", event),
527+
max_request_body_size=self.options.get("max_request_body_size"),
528+
max_value_length=self.options.get("max_value_length"),
529+
),
526530
)
527531

528532
before_send = self.options["before_send"]
@@ -720,9 +724,6 @@ def capture_event(
720724
721725
:returns: An event ID. May be `None` if there is no DSN set or of if the SDK decided to discard the event for other reasons. In such situations setting `debug=True` on `init()` may help.
722726
"""
723-
if disable_capture_event.get(False):
724-
return None
725-
726727
if hint is None:
727728
hint = {}
728729
event_id = event.get("event_id")

sentry_sdk/consts.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ class OP:
432432
HTTP_CLIENT_STREAM = "http.client.stream"
433433
HTTP_SERVER = "http.server"
434434
MIDDLEWARE_DJANGO = "middleware.django"
435+
MIDDLEWARE_LITESTAR = "middleware.litestar"
436+
MIDDLEWARE_LITESTAR_RECEIVE = "middleware.litestar.receive"
437+
MIDDLEWARE_LITESTAR_SEND = "middleware.litestar.send"
435438
MIDDLEWARE_STARLETTE = "middleware.starlette"
436439
MIDDLEWARE_STARLETTE_RECEIVE = "middleware.starlette.receive"
437440
MIDDLEWARE_STARLETTE_SEND = "middleware.starlette.send"
@@ -555,4 +558,4 @@ def _get_default_options():
555558
del _get_default_options
556559

557560

558-
VERSION = "2.11.0"
561+
VERSION = "2.12.0"

0 commit comments

Comments
 (0)
0