Skip to content

Commit 20c7e5b

Browse files
committed
Merge remote-tracking branch 'origin/master' into potel-base
2 parents 9536cd5 + 6a1b7d4 commit 20c7e5b

Some content is hidden

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

66 files changed

+3003
-330
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- name: Get auth token
2222
id: token
23-
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
23+
uses: actions/create-github-app-token@67e27a7eb7db372a1c61a7f9bdab8699e9ee57f7 # v1.11.3
2424
with:
2525
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
2626
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
coverage xml
9090
- name: Upload coverage to Codecov
9191
if: ${{ !cancelled() }}
92-
uses: codecov/codecov-action@v5.1.2
92+
uses: codecov/codecov-action@v5.3.1
9393
with:
9494
token: ${{ secrets.CODECOV_TOKEN }}
9595
files: coverage.xml

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
coverage xml
6767
- name: Upload coverage to Codecov
6868
if: ${{ !cancelled() }}
69-
uses: codecov/codecov-action@v5.1.2
69+
uses: codecov/codecov-action@v5.3.1
7070
with:
7171
token: ${{ secrets.CODECOV_TOKEN }}
7272
files: coverage.xml
@@ -124,7 +124,7 @@ jobs:
124124
coverage xml
125125
- name: Upload coverage to Codecov
126126
if: ${{ !cancelled() }}
127-
uses: codecov/codecov-action@v5.1.2
127+
uses: codecov/codecov-action@v5.3.1
128128
with:
129129
token: ${{ secrets.CODECOV_TOKEN }}
130130
files: coverage.xml

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
coverage xml
5555
- name: Upload coverage to Codecov
5656
if: ${{ !cancelled() }}
57-
uses: codecov/codecov-action@v5.1.2
57+
uses: codecov/codecov-action@v5.3.1
5858
with:
5959
token: ${{ secrets.CODECOV_TOKEN }}
6060
files: coverage.xml

CHANGELOG.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,48 @@
11
# Changelog
22

3+
## 2.21.0
4+
5+
### Various fixes & improvements
6+
7+
- Fix incompatibility with new Strawberry version (#4026) by @sentrivana
8+
- Add `failed_request_status_codes` to Litestar (#4021) by @vrslev
9+
10+
See https://docs.sentry.io/platforms/python/integrations/litestar/ for details.
11+
- Deprecate `enable_tracing` option (#3935) by @antonpirker
12+
13+
The `enable_tracing` option is now deprecated. Please use `traces_sample_rate` instead. See https://docs.sentry.io/platforms/python/configuration/options/#traces_sample_rate for more information.
14+
- Explicitly use `None` default when checking metadata (#4039) by @mpurnell1
15+
- Fix bug where concurrent accesses to the flags property could raise a `RuntimeError` (#4034) by @cmanallen
16+
- Add more min versions of frameworks (#3973) by @sentrivana
17+
- Set level based on status code for HTTP client breadcrumbs (#4004) by @sentrivana
18+
- Don't set transaction status to error on `sys.exit(0)` (#4025) by @sentrivana
19+
- Continuous profiling sample rate (#4002) by @Zylphrex
20+
21+
Set `profile_session_sample_rate=1.0` in your `init()` to collect continuous profiles for 100% of profile sessions. See https://docs.sentry.io/platforms/python/profiling/#enable-continuous-profiling for more information.
22+
- Track and report spans that were dropped (#4005) by @constantinius
23+
- Change continuous profile buffer size (#3987) by @Zylphrex
24+
- Handle `MultiPartParserError` to avoid internal sentry crash (#4001) by @orhanhenrik
25+
- Handle `None` lineno in `get_source_context` (#3925) by @sentrivana
26+
- Add support for Python 3.12 and 3.13 to AWS Lambda integration (#3965) by @antonpirker
27+
- Add `propagate_traces` deprecation warning (#3899) by @mgaligniana
28+
- Check that `__module__` is `str` (#3942) by @szokeasaurusrex
29+
- Add `__repr__` to `Baggage` (#4043) by @szokeasaurusrex
30+
- Fix a typo (#3923) by @antonpirker
31+
- Fix various CI errors on master (#4009) by @Zylphrex
32+
- Split gevent tests off (#3964) by @sentrivana
33+
- Add tox generation script, but don't use it yet (#3971) by @sentrivana
34+
- Use `httpx_mock` in `test_httpx` (#3967) by @sl0thentr0py
35+
- Fix typo in test name (#4036) by @szokeasaurusrex
36+
- Fix mypy (#4019) by @sentrivana
37+
- Test Celery's latest RC (#3938) by @sentrivana
38+
- Bump `actions/create-github-app-token` from `1.11.2` to `1.11.3` (#4023) by @dependabot
39+
- Bump `actions/create-github-app-token` from `1.11.1` to `1.11.2` (#4015) by @dependabot
40+
- Bump `codecov/codecov-action` from `5.1.2` to `5.3.1` (#3995) by @dependabot
41+
342
## 2.20.0
443

544
- **New integration:** Add [Typer](https://typer.tiangolo.com/) integration (#3869) by @patrick91
6-
45+
746
For more information, see the documentation for the [TyperIntegration](https://docs.sentry.io/platforms/python/integrations/typer/).
847

948
- **New integration:** Add [Unleash](https://www.getunleash.io/) feature flagging integration (#3888) by @aliu39
@@ -85,7 +124,7 @@
85124
### Various fixes & improvements
86125

87126
- **New integration:** Add [LaunchDarkly](https://launchdarkly.com/) integration (#3648) by @cmanallen
88-
127+
89128
For more information, see the documentation for the [LaunchDarklyIntegration](https://docs.sentry.io/platforms/python/integrations/launchdarkly/).
90129

91130
- **New integration:** Add [OpenFeature](https://openfeature.dev/) feature flagging integration (#3648) by @cmanallen

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-2024 Functional Software, Inc. dba Sentry
3+
Copyright (c) 2018 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

docs/conf.py

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

36-
release = "2.20.0"
36+
release = "2.21.0"
3737
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3838

3939

requirements-linting.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ flake8-bugbear
1515
pep8-naming
1616
pre-commit # local linting
1717
httpcore
18-
openfeature-sdk
1918
launchdarkly-server-sdk
19+
openfeature-sdk
20+
statsig
2021
UnleashClient
2122
typer
23+
strawberry-graphql

scripts/generate-test-files.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
# This script generates tox.ini and CI YAML files in one go.
4+
5+
set -xe
6+
7+
cd "$(dirname "$0")"
8+
9+
python -m venv toxgen.venv
10+
. toxgen.venv/bin/activate
11+
12+
pip install -e ..
13+
pip install -r populate_tox/requirements.txt
14+
pip install -r split_tox_gh_actions/requirements.txt
15+
16+
python populate_tox/populate_tox.py
17+
python split_tox_gh_actions/split_tox_gh_actions.py

scripts/populate_tox/README.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Populate Tox
2+
3+
We integrate with a number of frameworks and libraries and have a test suite for
4+
each. The tests run against different versions of the framework/library to make
5+
sure we support everything we claim to.
6+
7+
This `populate_tox.py` script is responsible for picking reasonable versions to
8+
test automatically and generating parts of `tox.ini` to capture this.
9+
10+
## How it works
11+
12+
There is a template in this directory called `tox.jinja` which contains a
13+
combination of hardcoded and generated entries.
14+
15+
The `populate_tox.py` script fills out the auto-generated part of that template.
16+
It does this by querying PyPI for each framework's package and its metadata and
17+
then determining which versions make sense to test to get good coverage.
18+
19+
The lowest supported and latest version of a framework are always tested, with
20+
a number of releases in between:
21+
- If the package has majors, we pick the highest version of each major. For the
22+
latest major, we also pick the lowest version in that major.
23+
- If the package doesn't have multiple majors, we pick two versions in between
24+
lowest and highest.
25+
26+
#### Caveats
27+
28+
- Make sure the integration name is the same everywhere. If it consists of
29+
multiple words, use an underscore instead of a hyphen.
30+
31+
## Defining constraints
32+
33+
The `TEST_SUITE_CONFIG` dictionary defines, for each integration test suite,
34+
the main package (framework, library) to test with; any additional test
35+
dependencies, optionally gated behind specific conditions; and optionally
36+
the Python versions to test on.
37+
38+
Constraints are defined using the format specified below. The following sections describe each key.
39+
40+
```
41+
integration_name: {
42+
"package": name_of_main_package_on_pypi,
43+
"deps": {
44+
rule1: [package1, package2, ...],
45+
rule2: [package3, package4, ...],
46+
},
47+
"python": python_version_specifier,
48+
}
49+
```
50+
51+
### `package`
52+
53+
The name of the third party package as it's listed on PyPI. The script will
54+
be picking different versions of this package to test.
55+
56+
This key is mandatory.
57+
58+
### `deps`
59+
60+
The test dependencies of the test suite. They're defined as a dictionary of
61+
`rule: [package1, package2, ...]` key-value pairs. All packages
62+
in the package list of a rule will be installed as long as the rule applies.
63+
64+
`rule`s are predefined. Each `rule` must be one of the following:
65+
- `*`: packages will be always installed
66+
- a version specifier on the main package (e.g. `<=0.32`): packages will only
67+
be installed if the main package falls into the version bounds specified
68+
- specific Python version(s) in the form `py3.8,py3.9`: packages will only be
69+
installed if the Python version matches one from the list
70+
71+
Rules can be used to specify version bounds on older versions of the main
72+
package's dependencies, for example. If e.g. Flask tests generally need
73+
Werkzeug and don't care about its version, but Flask older than 3.0 needs
74+
a specific Werkzeug version to work, you can say:
75+
76+
```python
77+
"flask": {
78+
"deps": {
79+
"*": ["Werkzeug"],
80+
"<3.0": ["Werkzeug<2.1.0"],
81+
},
82+
...
83+
}
84+
```
85+
86+
If you need to install a specific version of a secondary dependency on specific
87+
Python versions, you can say:
88+
89+
```python
90+
"celery": {
91+
"deps": {
92+
"*": ["newrelic", "redis"],
93+
"py3.7": ["importlib-metadata<5.0"],
94+
},
95+
...
96+
}
97+
```
98+
This key is optional.
99+
100+
### `python`
101+
102+
Sometimes, the whole test suite should only run on specific Python versions.
103+
This can be achieved via the `python` key, which expects a version specifier.
104+
105+
For example, if you want AIOHTTP tests to only run on Python 3.7+, you can say:
106+
107+
```python
108+
"aiohttp": {
109+
"python": ">=3.7",
110+
...
111+
}
112+
```
113+
114+
The `python` key is optional, and when possible, it should be omitted. The script
115+
should automatically detect which Python versions the package supports.
116+
However, if a package has broken
117+
metadata or the SDK is explicitly not supporting some packages on specific
118+
Python versions (because of, for example, broken context vars), the `python`
119+
key can be used.
120+
121+
122+
## How-Tos
123+
124+
### Add a new test suite
125+
126+
1. Add the minimum supported version of the framework/library to `_MIN_VERSIONS`
127+
in `integrations/__init__.py`. This should be the lowest version of the
128+
framework that we can guarantee works with the SDK. If you've just added the
129+
integration, you should generally set this to the latest version of the framework
130+
at the time.
131+
2. Add the integration and any constraints to `TEST_SUITE_CONFIG`. See the
132+
"Defining constraints" section for the format.
133+
3. Add the integration to one of the groups in the `GROUPS` dictionary in
134+
`scripts/split_tox_gh_actions/split_tox_gh_actions.py`.
135+
4. Add the `TESTPATH` for the test suite in `tox.jinja`'s `setenv` section.
136+
5. Run `scripts/generate-test-files.sh` and commit the changes.
137+
138+
### Migrate a test suite to populate_tox.py
139+
140+
A handful of integration test suites are still hardcoded. The goal is to migrate
141+
them all to `populate_tox.py` over time.
142+
143+
1. Remove the integration from the `IGNORE` list in `populate_tox.py`.
144+
2. Remove the hardcoded entries for the integration from the `envlist` and `deps` sections of `tox.jinja`.
145+
3. Run `scripts/generate-test-files.sh`.
146+
4. Run the test suite, either locally or by creating a PR.
147+
5. Address any test failures that happen.
148+
149+
You might have to introduce additional version bounds on the dependencies of the
150+
package. Try to determine the source of the failure and address it.
151+
152+
Common scenarios:
153+
- An old version of the tested package installs a dependency without defining
154+
an upper version bound on it. A new version of the dependency is installed that
155+
is incompatible with the package. In this case you need to determine which
156+
versions of the dependency don't contain the breaking change and restrict this
157+
in `TEST_SUITE_CONFIG`.
158+
- Tests are failing on an old Python version. In this case first double-check
159+
whether we were even testing them on that version in the original `tox.ini`.

0 commit comments

Comments
 (0)