Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into potel-base
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py committed Feb 17, 2025
2 parents 9536cd5 + 6a1b7d4 commit 20c7e5b
Show file tree
Hide file tree
Showing 66 changed files with 3,003 additions and 330 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- name: Get auth token
id: token
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
uses: actions/create-github-app-token@67e27a7eb7db372a1c61a7f9bdab8699e9ee57f7 # v1.11.3
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5.1.2
uses: codecov/codecov-action@v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5.1.2
uses: codecov/codecov-action@v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5.1.2
uses: codecov/codecov-action@v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5.1.2
uses: codecov/codecov-action@v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
43 changes: 41 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,48 @@
# Changelog

## 2.21.0

### Various fixes & improvements

- Fix incompatibility with new Strawberry version (#4026) by @sentrivana
- Add `failed_request_status_codes` to Litestar (#4021) by @vrslev

See https://docs.sentry.io/platforms/python/integrations/litestar/ for details.
- Deprecate `enable_tracing` option (#3935) by @antonpirker

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.
- Explicitly use `None` default when checking metadata (#4039) by @mpurnell1
- Fix bug where concurrent accesses to the flags property could raise a `RuntimeError` (#4034) by @cmanallen
- Add more min versions of frameworks (#3973) by @sentrivana
- Set level based on status code for HTTP client breadcrumbs (#4004) by @sentrivana
- Don't set transaction status to error on `sys.exit(0)` (#4025) by @sentrivana
- Continuous profiling sample rate (#4002) by @Zylphrex

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.
- Track and report spans that were dropped (#4005) by @constantinius
- Change continuous profile buffer size (#3987) by @Zylphrex
- Handle `MultiPartParserError` to avoid internal sentry crash (#4001) by @orhanhenrik
- Handle `None` lineno in `get_source_context` (#3925) by @sentrivana
- Add support for Python 3.12 and 3.13 to AWS Lambda integration (#3965) by @antonpirker
- Add `propagate_traces` deprecation warning (#3899) by @mgaligniana
- Check that `__module__` is `str` (#3942) by @szokeasaurusrex
- Add `__repr__` to `Baggage` (#4043) by @szokeasaurusrex
- Fix a typo (#3923) by @antonpirker
- Fix various CI errors on master (#4009) by @Zylphrex
- Split gevent tests off (#3964) by @sentrivana
- Add tox generation script, but don't use it yet (#3971) by @sentrivana
- Use `httpx_mock` in `test_httpx` (#3967) by @sl0thentr0py
- Fix typo in test name (#4036) by @szokeasaurusrex
- Fix mypy (#4019) by @sentrivana
- Test Celery's latest RC (#3938) by @sentrivana
- Bump `actions/create-github-app-token` from `1.11.2` to `1.11.3` (#4023) by @dependabot
- Bump `actions/create-github-app-token` from `1.11.1` to `1.11.2` (#4015) by @dependabot
- Bump `codecov/codecov-action` from `5.1.2` to `5.3.1` (#3995) by @dependabot

## 2.20.0

- **New integration:** Add [Typer](https://typer.tiangolo.com/) integration (#3869) by @patrick91

For more information, see the documentation for the [TyperIntegration](https://docs.sentry.io/platforms/python/integrations/typer/).

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

- **New integration:** Add [LaunchDarkly](https://launchdarkly.com/) integration (#3648) by @cmanallen

For more information, see the documentation for the [LaunchDarklyIntegration](https://docs.sentry.io/platforms/python/integrations/launchdarkly/).

- **New integration:** Add [OpenFeature](https://openfeature.dev/) feature flagging integration (#3648) by @cmanallen
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

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

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year)
author = "Sentry Team and Contributors"

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


Expand Down
4 changes: 3 additions & 1 deletion requirements-linting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ flake8-bugbear
pep8-naming
pre-commit # local linting
httpcore
openfeature-sdk
launchdarkly-server-sdk
openfeature-sdk
statsig
UnleashClient
typer
strawberry-graphql
17 changes: 17 additions & 0 deletions scripts/generate-test-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

# This script generates tox.ini and CI YAML files in one go.

set -xe

cd "$(dirname "$0")"

python -m venv toxgen.venv
. toxgen.venv/bin/activate

pip install -e ..
pip install -r populate_tox/requirements.txt
pip install -r split_tox_gh_actions/requirements.txt

python populate_tox/populate_tox.py
python split_tox_gh_actions/split_tox_gh_actions.py
159 changes: 159 additions & 0 deletions scripts/populate_tox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Populate Tox

We integrate with a number of frameworks and libraries and have a test suite for
each. The tests run against different versions of the framework/library to make
sure we support everything we claim to.

This `populate_tox.py` script is responsible for picking reasonable versions to
test automatically and generating parts of `tox.ini` to capture this.

## How it works

There is a template in this directory called `tox.jinja` which contains a
combination of hardcoded and generated entries.

The `populate_tox.py` script fills out the auto-generated part of that template.
It does this by querying PyPI for each framework's package and its metadata and
then determining which versions make sense to test to get good coverage.

The lowest supported and latest version of a framework are always tested, with
a number of releases in between:
- If the package has majors, we pick the highest version of each major. For the
latest major, we also pick the lowest version in that major.
- If the package doesn't have multiple majors, we pick two versions in between
lowest and highest.

#### Caveats

- Make sure the integration name is the same everywhere. If it consists of
multiple words, use an underscore instead of a hyphen.

## Defining constraints

The `TEST_SUITE_CONFIG` dictionary defines, for each integration test suite,
the main package (framework, library) to test with; any additional test
dependencies, optionally gated behind specific conditions; and optionally
the Python versions to test on.

Constraints are defined using the format specified below. The following sections describe each key.

```
integration_name: {
"package": name_of_main_package_on_pypi,
"deps": {
rule1: [package1, package2, ...],
rule2: [package3, package4, ...],
},
"python": python_version_specifier,
}
```

### `package`

The name of the third party package as it's listed on PyPI. The script will
be picking different versions of this package to test.

This key is mandatory.

### `deps`

The test dependencies of the test suite. They're defined as a dictionary of
`rule: [package1, package2, ...]` key-value pairs. All packages
in the package list of a rule will be installed as long as the rule applies.

`rule`s are predefined. Each `rule` must be one of the following:
- `*`: packages will be always installed
- a version specifier on the main package (e.g. `<=0.32`): packages will only
be installed if the main package falls into the version bounds specified
- specific Python version(s) in the form `py3.8,py3.9`: packages will only be
installed if the Python version matches one from the list

Rules can be used to specify version bounds on older versions of the main
package's dependencies, for example. If e.g. Flask tests generally need
Werkzeug and don't care about its version, but Flask older than 3.0 needs
a specific Werkzeug version to work, you can say:

```python
"flask": {
"deps": {
"*": ["Werkzeug"],
"<3.0": ["Werkzeug<2.1.0"],
},
...
}
```

If you need to install a specific version of a secondary dependency on specific
Python versions, you can say:

```python
"celery": {
"deps": {
"*": ["newrelic", "redis"],
"py3.7": ["importlib-metadata<5.0"],
},
...
}
```
This key is optional.

### `python`

Sometimes, the whole test suite should only run on specific Python versions.
This can be achieved via the `python` key, which expects a version specifier.

For example, if you want AIOHTTP tests to only run on Python 3.7+, you can say:

```python
"aiohttp": {
"python": ">=3.7",
...
}
```

The `python` key is optional, and when possible, it should be omitted. The script
should automatically detect which Python versions the package supports.
However, if a package has broken
metadata or the SDK is explicitly not supporting some packages on specific
Python versions (because of, for example, broken context vars), the `python`
key can be used.


## How-Tos

### Add a new test suite

1. Add the minimum supported version of the framework/library to `_MIN_VERSIONS`
in `integrations/__init__.py`. This should be the lowest version of the
framework that we can guarantee works with the SDK. If you've just added the
integration, you should generally set this to the latest version of the framework
at the time.
2. Add the integration and any constraints to `TEST_SUITE_CONFIG`. See the
"Defining constraints" section for the format.
3. Add the integration to one of the groups in the `GROUPS` dictionary in
`scripts/split_tox_gh_actions/split_tox_gh_actions.py`.
4. Add the `TESTPATH` for the test suite in `tox.jinja`'s `setenv` section.
5. Run `scripts/generate-test-files.sh` and commit the changes.

### Migrate a test suite to populate_tox.py

A handful of integration test suites are still hardcoded. The goal is to migrate
them all to `populate_tox.py` over time.

1. Remove the integration from the `IGNORE` list in `populate_tox.py`.
2. Remove the hardcoded entries for the integration from the `envlist` and `deps` sections of `tox.jinja`.
3. Run `scripts/generate-test-files.sh`.
4. Run the test suite, either locally or by creating a PR.
5. Address any test failures that happen.

You might have to introduce additional version bounds on the dependencies of the
package. Try to determine the source of the failure and address it.

Common scenarios:
- An old version of the tested package installs a dependency without defining
an upper version bound on it. A new version of the dependency is installed that
is incompatible with the package. In this case you need to determine which
versions of the dependency don't contain the breaking change and restrict this
in `TEST_SUITE_CONFIG`.
- Tests are failing on an old Python version. In this case first double-check
whether we were even testing them on that version in the original `tox.ini`.
Loading

0 comments on commit 20c7e5b

Please sign in to comment.