getsentry/sentry-python
### [`v1.25.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1251)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.25.0...1.25.1)
##### Django update (ongoing)
Collections of improvements to our Django integration.
By: [@mgaligniana](https://togithub.com/mgaligniana) ([#1773](https://togithub.com/getsentry/sentry-python/issues/1773))
##### Various fixes & improvements
- Fix `parse_url` ([#2161](https://togithub.com/getsentry/sentry-python/issues/2161)) by [@sentrivana](https://togithub.com/sentrivana) and [@antonpirker](https://togithub.com/antonpirker)
Our URL sanitization used in multiple integrations broke with the recent Python security update. If you started seeing `ValueError`s with `"'Filtered' does not appear to be an IPv4 or IPv6 address"`, this release fixes that. See [the original issue](https://togithub.com/getsentry/sentry-python/issues/2160) for more context.
- Better version parsing in integrations ([#2152](https://togithub.com/getsentry/sentry-python/issues/2152)) by [@antonpirker](https://togithub.com/antonpirker)
We now properly support all integration versions that conform to [PEP 440](https://peps.python.org/pep-0440/). This replaces our naïve version parsing that wouldn't accept versions such as `2.0.0rc1` or `2.0.5.post1`.
- Align HTTP status code as span data field `http.response.status_code` ([#2113](https://togithub.com/getsentry/sentry-python/issues/2113)) by [@antonpirker](https://togithub.com/antonpirker)
- Do not encode cached value to determine size ([#2143](https://togithub.com/getsentry/sentry-python/issues/2143)) by [@sentrivana](https://togithub.com/sentrivana)
- Fix using `unittest.mock` whenever available ([#1926](https://togithub.com/getsentry/sentry-python/issues/1926)) by [@mgorny](https://togithub.com/mgorny)
- Fix 2.7 `common` tests ([#2145](https://togithub.com/getsentry/sentry-python/issues/2145)) by [@sentrivana](https://togithub.com/sentrivana)
- Bump `actions/stale` from `6` to `8` ([#1978](https://togithub.com/getsentry/sentry-python/issues/1978)) by [@dependabot](https://togithub.com/dependabot)
- Bump `black` from `22.12.0` to `23.3.0` ([#1984](https://togithub.com/getsentry/sentry-python/issues/1984)) by [@dependabot](https://togithub.com/dependabot)
- Bump `mypy` from `1.2.0` to `1.3.0` ([#2110](https://togithub.com/getsentry/sentry-python/issues/2110)) by [@dependabot](https://togithub.com/dependabot)
- Bump `sphinx` from `5.3.0` to `7.0.1` ([#2112](https://togithub.com/getsentry/sentry-python/issues/2112)) by [@dependabot](https://togithub.com/dependabot)
### [`v1.25.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1250)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.24.0...1.25.0)
##### Various fixes & improvements
- Support urllib3>=2.0.0 ([#2148](https://togithub.com/getsentry/sentry-python/issues/2148)) by [@asottile-sentry](https://togithub.com/asottile-sentry)
We're now supporting urllib3's new major version, 2.0.0. If you encounter issues (e.g. some of your dependencies not supporting the new urllib3 version yet) you might consider pinning the urllib3 version to `<2.0.0` manually in your project. Check out the [the urllib3 migration guide](https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html#migrating-as-an-application-developer) for details.
- Auto-retry tests on failure ([#2134](https://togithub.com/getsentry/sentry-python/issues/2134)) by [@sentrivana](https://togithub.com/sentrivana)
- Correct `importlib.metadata` check in `test_modules` ([#2149](https://togithub.com/getsentry/sentry-python/issues/2149)) by [@asottile-sentry](https://togithub.com/asottile-sentry)
- Fix distribution name normalization (PEP-0503) ([#2144](https://togithub.com/getsentry/sentry-python/issues/2144)) by [@rominf](https://togithub.com/rominf)
- Fix `functions_to_trace` typing ([#2141](https://togithub.com/getsentry/sentry-python/issues/2141)) by [@rcmarron](https://togithub.com/rcmarron)
### [`v1.24.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1240)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.23.1...1.24.0)
##### Various fixes & improvements
- **New:** Celery Beat exclude tasks option ([#2130](https://togithub.com/getsentry/sentry-python/issues/2130)) by [@antonpirker](https://togithub.com/antonpirker)
You can exclude Celery Beat tasks from being auto-instrumented. To do this, add a list of tasks you want to exclude as option `exclude_beat_tasks` when creating `CeleryIntegration`. The list can contain simple strings with the full task name, as specified in the Celery Beat schedule, or regular expressions to match multiple tasks.
For more information, see the documentation for [Crons](https://docs.sentry.io/platforms/python/guides/celery/crons/) for more information.
Usage:
```python
exclude_beat_tasks = [
"some-task-a",
"payment-check-.*",
]
sentry_sdk.init(
dsn='___PUBLIC_DSN___',
integrations=[
CeleryIntegration(
monitor_beat_tasks=True,
exclude_beat_tasks=exclude_beat_tasks,
),
],
)
```
In this example the task `some-task-a` and all tasks with a name starting with `payment-check-` will be ignored.
- **New:** Add support for **ExceptionGroups** ([#2025](https://togithub.com/getsentry/sentry-python/issues/2025)) by [@antonpirker](https://togithub.com/antonpirker)
*Note:* If running Self-Hosted Sentry, you should wait to adopt this SDK update until after updating to the 23.6.0 (est. June 2023) release of Sentry. Updating early will not break anything, but you will not get the full benefit of the Exception Groups improvements to issue grouping that were added to the Sentry backend.
- Prefer `importlib.metadata` over `pkg_resources` if available ([#2081](https://togithub.com/getsentry/sentry-python/issues/2081)) by [@sentrivana](https://togithub.com/sentrivana)
- Work with a copy of request, vars in the event ([#2125](https://togithub.com/getsentry/sentry-python/issues/2125)) by [@sentrivana](https://togithub.com/sentrivana)
- Pinned version of dependency that broke the build ([#2133](https://togithub.com/getsentry/sentry-python/issues/2133)) by [@antonpirker](https://togithub.com/antonpirker)
### [`v1.23.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1231)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.23.0...1.23.1)
##### Various fixes & improvements
- Disable Django Cache spans by default. ([#2120](https://togithub.com/getsentry/sentry-python/issues/2120)) by [@antonpirker](https://togithub.com/antonpirker)
### [`v1.23.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1230)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.22.2...1.23.0)
##### Various fixes & improvements
- **New:** Add `loguru` integration ([#1994](https://togithub.com/getsentry/sentry-python/issues/1994)) by [@PerchunPak](https://togithub.com/PerchunPak)
Check [the documentation](https://docs.sentry.io/platforms/python/configuration/integrations/loguru/) for more information.
Usage:
```python
from loguru import logger
import sentry_sdk
from sentry_sdk.integrations.loguru import LoguruIntegration
sentry_sdk.init(
dsn="___PUBLIC_DSN___",
integrations=[
LoguruIntegration(),
],
)
logger.debug("I am ignored")
logger.info("I am a breadcrumb")
logger.error("I am an event", extra=dict(bar=43))
logger.exception("An exception happened")
```
- An error event with the message `"I am an event"` will be created.
- `"I am a breadcrumb"` will be attached as a breadcrumb to that event.
- `bar` will end up in the `extra` attributes of that event.
- `"An exception happened"` will send the current exception from `sys.exc_info()` with the stack trace to Sentry. If there's no exception, the current stack will be attached.
- The debug message `"I am ignored"` will not be captured by Sentry. To capture it, set `level` to `DEBUG` or lower in `LoguruIntegration`.
- Do not truncate request body if `request_bodies` is `"always"` ([#2092](https://togithub.com/getsentry/sentry-python/issues/2092)) by [@sentrivana](https://togithub.com/sentrivana)
- Fixed Celery headers for Beat auto-instrumentation ([#2102](https://togithub.com/getsentry/sentry-python/issues/2102)) by [@antonpirker](https://togithub.com/antonpirker)
- Add `db.operation` to Redis and MongoDB spans ([#2089](https://togithub.com/getsentry/sentry-python/issues/2089)) by [@antonpirker](https://togithub.com/antonpirker)
- Make sure we're importing `redis` the library ([#2106](https://togithub.com/getsentry/sentry-python/issues/2106)) by [@sentrivana](https://togithub.com/sentrivana)
- Add `include_source_context` option ([#2020](https://togithub.com/getsentry/sentry-python/issues/2020)) by [@farhat-nawaz](https://togithub.com/farhat-nawaz) and [@sentrivana](https://togithub.com/sentrivana)
- Import `Markup` from `markupsafe` ([#2047](https://togithub.com/getsentry/sentry-python/issues/2047)) by [@rco-ableton](https://togithub.com/rco-ableton)
- Fix `__qualname__` missing attribute in asyncio integration ([#2105](https://togithub.com/getsentry/sentry-python/issues/2105)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
- Remove relay extension from AWS Layer ([#2068](https://togithub.com/getsentry/sentry-python/issues/2068)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
- Add a note about `pip freeze` to the bug template ([#2103](https://togithub.com/getsentry/sentry-python/issues/2103)) by [@sentrivana](https://togithub.com/sentrivana)
### [`v1.22.2`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1222)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.22.1...1.22.2)
##### Various fixes & improvements
- Fix: Django caching spans when using keyword arguments ([#2086](https://togithub.com/getsentry/sentry-python/issues/2086)) by [@antonpirker](https://togithub.com/antonpirker)
- Fix: Duration in Celery Beat tasks monitoring ([#2087](https://togithub.com/getsentry/sentry-python/issues/2087)) by [@antonpirker](https://togithub.com/antonpirker)
- Fix: Docstrings of SPANDATA ([#2084](https://togithub.com/getsentry/sentry-python/issues/2084)) by [@antonpirker](https://togithub.com/antonpirker)
### [`v1.22.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1221)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.22.0...1.22.1)
##### Various fixes & improvements
- Fix: Handle a list of keys (not just a single key) in Django cache spans ([#2082](https://togithub.com/getsentry/sentry-python/issues/2082)) by [@antonpirker](https://togithub.com/antonpirker)
### [`v1.22.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1220)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.21.1...1.22.0)
##### Various fixes & improvements
- Add `cache.hit` and `cache.item_size` to Django ([#2057](https://togithub.com/getsentry/sentry-python/issues/2057)) by [@antonpirker](https://togithub.com/antonpirker)
*Note:* This will add spans for all requests to the caches configured in Django. This will probably add some overhead to your server an also add multiple spans to your performance waterfall diagrams. If you do not want this, you can disable this feature in the DjangoIntegration:
```python
sentry_sdk.init(
dsn="...",
integrations=[
DjangoIntegration(cache_spans=False),
]
)
```
- Use `http.method` instead of `method` ([#2054](https://togithub.com/getsentry/sentry-python/issues/2054)) by [@AbhiPrasad](https://togithub.com/AbhiPrasad)
- Handle non-int `exc.status_code` in Starlette ([#2075](https://togithub.com/getsentry/sentry-python/issues/2075)) by [@sentrivana](https://togithub.com/sentrivana)
- Handle SQLAlchemy `engine.name` being bytes ([#2074](https://togithub.com/getsentry/sentry-python/issues/2074)) by [@sentrivana](https://togithub.com/sentrivana)
- Fix `KeyError` in `capture_checkin` if SDK is not initialized ([#2073](https://togithub.com/getsentry/sentry-python/issues/2073)) by [@antonpirker](https://togithub.com/antonpirker)
- Use `functools.wrap` for `ThreadingIntegration` patches to fix attributes ([#2080](https://togithub.com/getsentry/sentry-python/issues/2080)) by [@EpicWink](https://togithub.com/EpicWink)
- Pin `urllib3` to <2.0.0 for now ([#2069](https://togithub.com/getsentry/sentry-python/issues/2069)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
### [`v1.21.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1211)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.21.0...1.21.1)
##### Various fixes & improvements
- Do not send monitor_config when unset ([#2058](https://togithub.com/getsentry/sentry-python/issues/2058)) by [@evanpurkhiser](https://togithub.com/evanpurkhiser)
- Add `db.system` span data ([#2040](https://togithub.com/getsentry/sentry-python/issues/2040), [#2042](https://togithub.com/getsentry/sentry-python/issues/2042)) by [@antonpirker](https://togithub.com/antonpirker)
- Fix memory leak in profiling ([#2049](https://togithub.com/getsentry/sentry-python/issues/2049)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Fix crash loop when returning none in before_send ([#2045](https://togithub.com/getsentry/sentry-python/issues/2045)) by [@sentrivana](https://togithub.com/sentrivana)
### [`v1.21.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1210)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.20.0...1.21.0)
##### Various fixes & improvements
- Better handling of redis span/breadcrumb data ([#2033](https://togithub.com/getsentry/sentry-python/issues/2033)) by [@antonpirker](https://togithub.com/antonpirker)
*Note:* With this release we will limit the description of redis db spans and the data in breadcrumbs represting redis db operations to 1024 characters.
This can can lead to truncated data. If you do not want this there is a new parameter `max_data_size` in `RedisIntegration`. You can set this to `None` for disabling trimming.
Example for **disabling** trimming of redis commands in spans or breadcrumbs:
```python
sentry_sdk.init(
integrations=[
RedisIntegration(max_data_size=None),
]
)
```
Example for custom trim size of redis commands in spans or breadcrumbs:
```python
sentry_sdk.init(
integrations=[
RedisIntegration(max_data_size=50),
]
)`
```
- Add `db.system` to redis and SQLAlchemy db spans ([#2037](https://togithub.com/getsentry/sentry-python/issues/2037), [#2038](https://togithub.com/getsentry/sentry-python/issues/2038), [#2039](https://togithub.com/getsentry/sentry-python/issues/2039)) ([#2037](https://togithub.com/getsentry/sentry-python/issues/2037)) by [@AbhiPrasad](https://togithub.com/AbhiPrasad)
- Upgraded linting tooling ([#2026](https://togithub.com/getsentry/sentry-python/issues/2026)) by [@antonpirker](https://togithub.com/antonpirker)
- Made code more resilient. ([#2031](https://togithub.com/getsentry/sentry-python/issues/2031)) by [@antonpirker](https://togithub.com/antonpirker)
### [`v1.20.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1200)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.19.1...1.20.0)
##### Various fixes & improvements
- Send all events to /envelope endpoint when tracing is enabled ([#2009](https://togithub.com/getsentry/sentry-python/issues/2009)) by [@antonpirker](https://togithub.com/antonpirker)
*Note:* If you’re self-hosting Sentry 9, you need to stay in the previous version of the SDK or update your self-hosted to at least 20.6.0
- Profiling: Remove profile context from SDK ([#2013](https://togithub.com/getsentry/sentry-python/issues/2013)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Profiling: Additionl performance improvements to the profiler ([#1991](https://togithub.com/getsentry/sentry-python/issues/1991)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Fix: Celery Beat monitoring without restarting the Beat process ([#2001](https://togithub.com/getsentry/sentry-python/issues/2001)) by [@antonpirker](https://togithub.com/antonpirker)
- Fix: Using the Codecov uploader instead of deprecated python package ([#2011](https://togithub.com/getsentry/sentry-python/issues/2011)) by [@antonpirker](https://togithub.com/antonpirker)
- Fix: Support for Quart ([#2003](https://togithub.com/getsentry/sentry-python/issues/2003))\` ([#2003](https://togithub.com/getsentry/sentry-python/issues/2003)) by [@antonpirker](https://togithub.com/antonpirker)
### [`v1.19.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1191)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.19.0...1.19.1)
##### Various fixes & improvements
- Make auto monitoring beat update support Celery 4 and 5 ([#1989](https://togithub.com/getsentry/sentry-python/issues/1989)) by [@antonpirker](https://togithub.com/antonpirker)
### [`v1.19.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1190)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.18.0...1.19.0)
##### Various fixes & improvements
- **New:** [Celery Beat](https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html) auto monitoring ([#1967](https://togithub.com/getsentry/sentry-python/issues/1967)) by [@antonpirker](https://togithub.com/antonpirker)
The CeleryIntegration can now also monitor your Celery Beat scheduled tasks automatically using the new [Crons](https://blog.sentry.io/2023/01/04/cron-job-monitoring-beta-because-scheduled-jobs-fail-too/) feature of Sentry.
To learn more see our [Celery Beat Auto Discovery](https://docs.sentry.io/platforms/python/guides/celery/crons/) documentation.
Usage:
```python
from celery import Celery, signals
from celery.schedules import crontab
import sentry_sdk
from sentry_sdk.integrations.celery import CeleryIntegration
app = Celery('tasks', broker='...')
app.conf.beat_schedule = {
'set-in-beat-schedule': {
'task': 'tasks.some_important_task',
'schedule': crontab(...),
},
}
@signals.celeryd_init.connect
def init_sentry(**kwargs):
sentry_sdk.init(
dsn='...',
integrations=[CeleryIntegration(monitor_beat_tasks=True)], # 👈 here
environment="local.dev.grace",
release="v1.0",
)
```
This will auto detect all schedules tasks in your `beat_schedule` and will monitor them with Sentry [Crons](https://blog.sentry.io/2023/01/04/cron-job-monitoring-beta-because-scheduled-jobs-fail-too/).
- **New:** [gRPC](https://grpc.io/) integration ([#1911](https://togithub.com/getsentry/sentry-python/issues/1911)) by [@hossein-raeisi](https://togithub.com/hossein-raeisi)
The [gRPC](https://grpc.io/) integration instruments all incoming requests and outgoing unary-unary, unary-stream grpc requests using grpcio channels.
To learn more see our [gRPC Integration](https://docs.sentry.io/platforms/python/configuration/integrations/grpc/) documentation.
On the server:
```python
import grpc
from sentry_sdk.integrations.grpc.server import ServerInterceptor
server = grpc.server(
thread_pool=...,
interceptors=[ServerInterceptor()],
)
```
On the client:
```python
import grpc
from sentry_sdk.integrations.grpc.client import ClientInterceptor
with grpc.insecure_channel("example.com:12345") as channel:
channel = grpc.intercept_channel(channel, *[ClientInterceptor()])
```
- **New:** socket integration ([#1911](https://togithub.com/getsentry/sentry-python/issues/1911)) by [@hossein-raeisi](https://togithub.com/hossein-raeisi)
Use this integration to create spans for DNS resolves (`socket.getaddrinfo()`) and connection creations (`socket.create_connection()`).
To learn more see our [Socket Integration](https://docs.sentry.io/platforms/python/configuration/integrations/socket/) documentation.
Usage:
```python
import sentry_sdk
from sentry_sdk.integrations.socket import SocketIntegration
sentry_sdk.init(
dsn="___PUBLIC_DSN___",
integrations=[
SocketIntegration(),
],
)
```
- Fix: Do not trim span descriptions. ([#1983](https://togithub.com/getsentry/sentry-python/issues/1983)) by [@antonpirker](https://togithub.com/antonpirker)
### [`v1.18.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1180)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.17.0...1.18.0)
##### Various fixes & improvements
- **New:** Implement `EventScrubber` ([#1943](https://togithub.com/getsentry/sentry-python/issues/1943)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
To learn more see our [Scrubbing Sensitive Data](https://docs.sentry.io/platforms/python/data-management/sensitive-data/#event-scrubber) documentation.
Add a new `EventScrubber` class that scrubs certain potentially sensitive interfaces with a `DEFAULT_DENYLIST`. The default scrubber is automatically run if `send_default_pii = False`:
```python
import sentry_sdk
from sentry_sdk.scrubber import EventScrubber
sentry_sdk.init(
```
### ...
send_default_pii=False,
event_scrubber=EventScrubber(), # this is set by default
)
````
You can also pass in a custom `denylist` to the `EventScrubber` class and filter additional fields that you want.
```python
from sentry_sdk.scrubber import EventScrubber, DEFAULT_DENYLIST
````
### [`v1.17.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1170)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.16.0...1.17.0)
##### Various fixes & improvements
- **New:** Monitor Celery Beat tasks with Sentry [Cron Monitoring](https://docs.sentry.io/product/crons/).
With this feature you can make sure that your Celery beat tasks run at the right time and see if they where successful or not.
> **Warning**
> Cron Monitoring is currently in beta. Beta features are still in-progress and may have bugs. We recognize the irony.
> If you have any questions or feedback, please email us at crons-feedback@sentry.io, reach out via Discord (#cronjobs), or open an issue.
Usage:
```python
```
### [`v1.16.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1160)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.15.0...1.16.0)
##### Various fixes & improvements
- **New:** Add [arq](https://arq-docs.helpmanual.io/) Integration ([#1872](https://togithub.com/getsentry/sentry-python/issues/1872)) by [@Zhenay](https://togithub.com/Zhenay)
This integration will create performance spans when arq jobs will be enqueued and when they will be run.
It will also capture errors in jobs and will link them to the performance spans.
Usage:
```python
import asyncio
from httpx import AsyncClient
from arq import create_pool
from arq.connections import RedisSettings
import sentry_sdk
from sentry_sdk.integrations.arq import ArqIntegration
from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT
sentry_sdk.init(
dsn="...",
integrations=[ArqIntegration()],
)
async def download_content(ctx, url):
session: AsyncClient = ctx['session']
response = await session.get(url)
print(f'{url}: {response.text:.80}...')
return len(response.text)
async def startup(ctx):
ctx['session'] = AsyncClient()
async def shutdown(ctx):
await ctx['session'].aclose()
async def main():
with sentry_sdk.start_transaction(name="testing_arq_tasks", source=TRANSACTION_SOURCE_COMPONENT):
redis = await create_pool(RedisSettings())
for url in ('https://facebook.com', 'https://microsoft.com', 'https://github.com', "asdf"
):
await redis.enqueue_job('download_content', url)
class WorkerSettings:
functions = [download_content]
on_startup = startup
on_shutdown = shutdown
if __name__ == '__main__':
asyncio.run(main())
```
- Update of [Falcon](https://falconframework.org/) Integration ([#1733](https://togithub.com/getsentry/sentry-python/issues/1733)) by [@bartolootrit](https://togithub.com/bartolootrit)
- Adding [Cloud Resource Context](https://docs.sentry.io/platforms/python/configuration/integrations/cloudresourcecontext/) integration ([#1882](https://togithub.com/getsentry/sentry-python/issues/1882)) by [@antonpirker](https://togithub.com/antonpirker)
- Profiling: Use the transaction timestamps to anchor the profile ([#1898](https://togithub.com/getsentry/sentry-python/issues/1898)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Profiling: Add debug logs to profiling ([#1883](https://togithub.com/getsentry/sentry-python/issues/1883)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Profiling: Start profiler thread lazily ([#1903](https://togithub.com/getsentry/sentry-python/issues/1903)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Fixed checks for structured http data ([#1905](https://togithub.com/getsentry/sentry-python/issues/1905)) by [@antonpirker](https://togithub.com/antonpirker)
- Make `set_measurement` public api and remove experimental status ([#1909](https://togithub.com/getsentry/sentry-python/issues/1909)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
- Add `trace_propagation_targets` option ([#1916](https://togithub.com/getsentry/sentry-python/issues/1916)) by [@antonpirker](https://togithub.com/antonpirker)
- Add `enable_tracing` to default traces_sample_rate to 1.0 ([#1900](https://togithub.com/getsentry/sentry-python/issues/1900)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
- Remove deprecated `tracestate` ([#1907](https://togithub.com/getsentry/sentry-python/issues/1907)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
- Sanitize URLs in Span description and breadcrumbs ([#1876](https://togithub.com/getsentry/sentry-python/issues/1876)) by [@antonpirker](https://togithub.com/antonpirker)
- Mechanism should default to true unless set explicitly ([#1889](https://togithub.com/getsentry/sentry-python/issues/1889)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
- Better setting of in-app in stack frames ([#1894](https://togithub.com/getsentry/sentry-python/issues/1894)) by [@antonpirker](https://togithub.com/antonpirker)
- Add workflow to test gevent ([#1870](https://togithub.com/getsentry/sentry-python/issues/1870)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Updated outdated HTTPX test matrix ([#1917](https://togithub.com/getsentry/sentry-python/issues/1917)) by [@antonpirker](https://togithub.com/antonpirker)
- Switch to MIT license ([#1908](https://togithub.com/getsentry/sentry-python/issues/1908)) by [@cleptric](https://togithub.com/cleptric)
### [`v1.15.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1150)
[Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.14.0...1.15.0)
##### Various fixes & improvements
- New: Add [Huey](https://huey.readthedocs.io/en/latest/) Integration ([#1555](https://togithub.com/getsentry/sentry-python/issues/1555)) by [@Zhenay](https://togithub.com/Zhenay)
This integration will create performance spans when Huey tasks will be enqueued and when they will be executed.
Usage:
Task definition in `demo.py`:
```python
import time
from huey import SqliteHuey, crontab
import sentry_sdk
from sentry_sdk.integrations.huey import HueyIntegration
sentry_sdk.init(
dsn="...",
integrations=[
HueyIntegration(),
],
traces_sample_rate=1.0,
)
huey = SqliteHuey(filename='/tmp/demo.db')
@huey.task()
def add_numbers(a, b):
return a + b
```
Running the tasks in `run.py`:
```python
from demo import add_numbers, flaky_task, nightly_backup
import sentry_sdk
from sentry_sdk.integrations.huey import HueyIntegration
from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT, Transaction
def main():
sentry_sdk.init(
dsn="...",
integrations=[
HueyIntegration(),
],
traces_sample_rate=1.0,
)
with sentry_sdk.start_transaction(name="testing_huey_tasks", source=TRANSACTION_SOURCE_COMPONENT):
r = add_numbers(1, 2)
if __name__ == "__main__":
main()
```
- Profiling: Do not send single sample profiles ([#1879](https://togithub.com/getsentry/sentry-python/issues/1879)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Profiling: Add additional test coverage for profiler ([#1877](https://togithub.com/getsentry/sentry-python/issues/1877)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Profiling: Always use builtin time.sleep ([#1869](https://togithub.com/getsentry/sentry-python/issues/1869)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Profiling: Defaul in_app decision to None ([#1855](https://togithub.com/getsentry/sentry-python/issues/1855)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Profiling: Remove use of threading.Event ([#1864](https://togithub.com/getsentry/sentry-python/issues/1864)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Profiling: Enable profiling on all transactions ([#1797](https://togithub.com/getsentry/sentry-python/issues/1797)) by [@Zylphrex](https://togithub.com/Zylphrex)
- FastAPI: Fix check for Starlette in FastAPI integration ([#1868](https://togithub.com/getsentry/sentry-python/issues/1868)) by [@antonpirker](https://togithub.com/antonpirker)
- Flask: Do not overwrite default for username with email address in FlaskIntegration ([#1873](https://togithub.com/getsentry/sentry-python/issues/1873)) by [@homeworkprod](https://togithub.com/homeworkprod)
- Tests: Add py3.11 to test-common ([#1871](https://togithub.com/getsentry/sentry-python/issues/1871)) by [@Zylphrex](https://togithub.com/Zylphrex)
- Fix: Don't log whole event in before_send / event_processor drops ([#1863](https://togithub.com/getsentry/sentry-python/issues/1863)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
==1.14.0
->==1.25.1
Release Notes
getsentry/sentry-python
### [`v1.25.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1251) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.25.0...1.25.1) ##### Django update (ongoing) Collections of improvements to our Django integration. By: [@mgaligniana](https://togithub.com/mgaligniana) ([#1773](https://togithub.com/getsentry/sentry-python/issues/1773)) ##### Various fixes & improvements - Fix `parse_url` ([#2161](https://togithub.com/getsentry/sentry-python/issues/2161)) by [@sentrivana](https://togithub.com/sentrivana) and [@antonpirker](https://togithub.com/antonpirker) Our URL sanitization used in multiple integrations broke with the recent Python security update. If you started seeing `ValueError`s with `"'Filtered' does not appear to be an IPv4 or IPv6 address"`, this release fixes that. See [the original issue](https://togithub.com/getsentry/sentry-python/issues/2160) for more context. - Better version parsing in integrations ([#2152](https://togithub.com/getsentry/sentry-python/issues/2152)) by [@antonpirker](https://togithub.com/antonpirker) We now properly support all integration versions that conform to [PEP 440](https://peps.python.org/pep-0440/). This replaces our naïve version parsing that wouldn't accept versions such as `2.0.0rc1` or `2.0.5.post1`. - Align HTTP status code as span data field `http.response.status_code` ([#2113](https://togithub.com/getsentry/sentry-python/issues/2113)) by [@antonpirker](https://togithub.com/antonpirker) - Do not encode cached value to determine size ([#2143](https://togithub.com/getsentry/sentry-python/issues/2143)) by [@sentrivana](https://togithub.com/sentrivana) - Fix using `unittest.mock` whenever available ([#1926](https://togithub.com/getsentry/sentry-python/issues/1926)) by [@mgorny](https://togithub.com/mgorny) - Fix 2.7 `common` tests ([#2145](https://togithub.com/getsentry/sentry-python/issues/2145)) by [@sentrivana](https://togithub.com/sentrivana) - Bump `actions/stale` from `6` to `8` ([#1978](https://togithub.com/getsentry/sentry-python/issues/1978)) by [@dependabot](https://togithub.com/dependabot) - Bump `black` from `22.12.0` to `23.3.0` ([#1984](https://togithub.com/getsentry/sentry-python/issues/1984)) by [@dependabot](https://togithub.com/dependabot) - Bump `mypy` from `1.2.0` to `1.3.0` ([#2110](https://togithub.com/getsentry/sentry-python/issues/2110)) by [@dependabot](https://togithub.com/dependabot) - Bump `sphinx` from `5.3.0` to `7.0.1` ([#2112](https://togithub.com/getsentry/sentry-python/issues/2112)) by [@dependabot](https://togithub.com/dependabot) ### [`v1.25.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1250) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.24.0...1.25.0) ##### Various fixes & improvements - Support urllib3>=2.0.0 ([#2148](https://togithub.com/getsentry/sentry-python/issues/2148)) by [@asottile-sentry](https://togithub.com/asottile-sentry) We're now supporting urllib3's new major version, 2.0.0. If you encounter issues (e.g. some of your dependencies not supporting the new urllib3 version yet) you might consider pinning the urllib3 version to `<2.0.0` manually in your project. Check out the [the urllib3 migration guide](https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html#migrating-as-an-application-developer) for details. - Auto-retry tests on failure ([#2134](https://togithub.com/getsentry/sentry-python/issues/2134)) by [@sentrivana](https://togithub.com/sentrivana) - Correct `importlib.metadata` check in `test_modules` ([#2149](https://togithub.com/getsentry/sentry-python/issues/2149)) by [@asottile-sentry](https://togithub.com/asottile-sentry) - Fix distribution name normalization (PEP-0503) ([#2144](https://togithub.com/getsentry/sentry-python/issues/2144)) by [@rominf](https://togithub.com/rominf) - Fix `functions_to_trace` typing ([#2141](https://togithub.com/getsentry/sentry-python/issues/2141)) by [@rcmarron](https://togithub.com/rcmarron) ### [`v1.24.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1240) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.23.1...1.24.0) ##### Various fixes & improvements - **New:** Celery Beat exclude tasks option ([#2130](https://togithub.com/getsentry/sentry-python/issues/2130)) by [@antonpirker](https://togithub.com/antonpirker) You can exclude Celery Beat tasks from being auto-instrumented. To do this, add a list of tasks you want to exclude as option `exclude_beat_tasks` when creating `CeleryIntegration`. The list can contain simple strings with the full task name, as specified in the Celery Beat schedule, or regular expressions to match multiple tasks. For more information, see the documentation for [Crons](https://docs.sentry.io/platforms/python/guides/celery/crons/) for more information. Usage: ```python exclude_beat_tasks = [ "some-task-a", "payment-check-.*", ] sentry_sdk.init( dsn='___PUBLIC_DSN___', integrations=[ CeleryIntegration( monitor_beat_tasks=True, exclude_beat_tasks=exclude_beat_tasks, ), ], ) ``` In this example the task `some-task-a` and all tasks with a name starting with `payment-check-` will be ignored. - **New:** Add support for **ExceptionGroups** ([#2025](https://togithub.com/getsentry/sentry-python/issues/2025)) by [@antonpirker](https://togithub.com/antonpirker) *Note:* If running Self-Hosted Sentry, you should wait to adopt this SDK update until after updating to the 23.6.0 (est. June 2023) release of Sentry. Updating early will not break anything, but you will not get the full benefit of the Exception Groups improvements to issue grouping that were added to the Sentry backend. - Prefer `importlib.metadata` over `pkg_resources` if available ([#2081](https://togithub.com/getsentry/sentry-python/issues/2081)) by [@sentrivana](https://togithub.com/sentrivana) - Work with a copy of request, vars in the event ([#2125](https://togithub.com/getsentry/sentry-python/issues/2125)) by [@sentrivana](https://togithub.com/sentrivana) - Pinned version of dependency that broke the build ([#2133](https://togithub.com/getsentry/sentry-python/issues/2133)) by [@antonpirker](https://togithub.com/antonpirker) ### [`v1.23.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1231) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.23.0...1.23.1) ##### Various fixes & improvements - Disable Django Cache spans by default. ([#2120](https://togithub.com/getsentry/sentry-python/issues/2120)) by [@antonpirker](https://togithub.com/antonpirker) ### [`v1.23.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1230) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.22.2...1.23.0) ##### Various fixes & improvements - **New:** Add `loguru` integration ([#1994](https://togithub.com/getsentry/sentry-python/issues/1994)) by [@PerchunPak](https://togithub.com/PerchunPak) Check [the documentation](https://docs.sentry.io/platforms/python/configuration/integrations/loguru/) for more information. Usage: ```python from loguru import logger import sentry_sdk from sentry_sdk.integrations.loguru import LoguruIntegration sentry_sdk.init( dsn="___PUBLIC_DSN___", integrations=[ LoguruIntegration(), ], ) logger.debug("I am ignored") logger.info("I am a breadcrumb") logger.error("I am an event", extra=dict(bar=43)) logger.exception("An exception happened") ``` - An error event with the message `"I am an event"` will be created. - `"I am a breadcrumb"` will be attached as a breadcrumb to that event. - `bar` will end up in the `extra` attributes of that event. - `"An exception happened"` will send the current exception from `sys.exc_info()` with the stack trace to Sentry. If there's no exception, the current stack will be attached. - The debug message `"I am ignored"` will not be captured by Sentry. To capture it, set `level` to `DEBUG` or lower in `LoguruIntegration`. - Do not truncate request body if `request_bodies` is `"always"` ([#2092](https://togithub.com/getsentry/sentry-python/issues/2092)) by [@sentrivana](https://togithub.com/sentrivana) - Fixed Celery headers for Beat auto-instrumentation ([#2102](https://togithub.com/getsentry/sentry-python/issues/2102)) by [@antonpirker](https://togithub.com/antonpirker) - Add `db.operation` to Redis and MongoDB spans ([#2089](https://togithub.com/getsentry/sentry-python/issues/2089)) by [@antonpirker](https://togithub.com/antonpirker) - Make sure we're importing `redis` the library ([#2106](https://togithub.com/getsentry/sentry-python/issues/2106)) by [@sentrivana](https://togithub.com/sentrivana) - Add `include_source_context` option ([#2020](https://togithub.com/getsentry/sentry-python/issues/2020)) by [@farhat-nawaz](https://togithub.com/farhat-nawaz) and [@sentrivana](https://togithub.com/sentrivana) - Import `Markup` from `markupsafe` ([#2047](https://togithub.com/getsentry/sentry-python/issues/2047)) by [@rco-ableton](https://togithub.com/rco-ableton) - Fix `__qualname__` missing attribute in asyncio integration ([#2105](https://togithub.com/getsentry/sentry-python/issues/2105)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py) - Remove relay extension from AWS Layer ([#2068](https://togithub.com/getsentry/sentry-python/issues/2068)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py) - Add a note about `pip freeze` to the bug template ([#2103](https://togithub.com/getsentry/sentry-python/issues/2103)) by [@sentrivana](https://togithub.com/sentrivana) ### [`v1.22.2`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1222) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.22.1...1.22.2) ##### Various fixes & improvements - Fix: Django caching spans when using keyword arguments ([#2086](https://togithub.com/getsentry/sentry-python/issues/2086)) by [@antonpirker](https://togithub.com/antonpirker) - Fix: Duration in Celery Beat tasks monitoring ([#2087](https://togithub.com/getsentry/sentry-python/issues/2087)) by [@antonpirker](https://togithub.com/antonpirker) - Fix: Docstrings of SPANDATA ([#2084](https://togithub.com/getsentry/sentry-python/issues/2084)) by [@antonpirker](https://togithub.com/antonpirker) ### [`v1.22.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1221) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.22.0...1.22.1) ##### Various fixes & improvements - Fix: Handle a list of keys (not just a single key) in Django cache spans ([#2082](https://togithub.com/getsentry/sentry-python/issues/2082)) by [@antonpirker](https://togithub.com/antonpirker) ### [`v1.22.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1220) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.21.1...1.22.0) ##### Various fixes & improvements - Add `cache.hit` and `cache.item_size` to Django ([#2057](https://togithub.com/getsentry/sentry-python/issues/2057)) by [@antonpirker](https://togithub.com/antonpirker) *Note:* This will add spans for all requests to the caches configured in Django. This will probably add some overhead to your server an also add multiple spans to your performance waterfall diagrams. If you do not want this, you can disable this feature in the DjangoIntegration: ```python sentry_sdk.init( dsn="...", integrations=[ DjangoIntegration(cache_spans=False), ] ) ``` - Use `http.method` instead of `method` ([#2054](https://togithub.com/getsentry/sentry-python/issues/2054)) by [@AbhiPrasad](https://togithub.com/AbhiPrasad) - Handle non-int `exc.status_code` in Starlette ([#2075](https://togithub.com/getsentry/sentry-python/issues/2075)) by [@sentrivana](https://togithub.com/sentrivana) - Handle SQLAlchemy `engine.name` being bytes ([#2074](https://togithub.com/getsentry/sentry-python/issues/2074)) by [@sentrivana](https://togithub.com/sentrivana) - Fix `KeyError` in `capture_checkin` if SDK is not initialized ([#2073](https://togithub.com/getsentry/sentry-python/issues/2073)) by [@antonpirker](https://togithub.com/antonpirker) - Use `functools.wrap` for `ThreadingIntegration` patches to fix attributes ([#2080](https://togithub.com/getsentry/sentry-python/issues/2080)) by [@EpicWink](https://togithub.com/EpicWink) - Pin `urllib3` to <2.0.0 for now ([#2069](https://togithub.com/getsentry/sentry-python/issues/2069)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py) ### [`v1.21.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1211) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.21.0...1.21.1) ##### Various fixes & improvements - Do not send monitor_config when unset ([#2058](https://togithub.com/getsentry/sentry-python/issues/2058)) by [@evanpurkhiser](https://togithub.com/evanpurkhiser) - Add `db.system` span data ([#2040](https://togithub.com/getsentry/sentry-python/issues/2040), [#2042](https://togithub.com/getsentry/sentry-python/issues/2042)) by [@antonpirker](https://togithub.com/antonpirker) - Fix memory leak in profiling ([#2049](https://togithub.com/getsentry/sentry-python/issues/2049)) by [@Zylphrex](https://togithub.com/Zylphrex) - Fix crash loop when returning none in before_send ([#2045](https://togithub.com/getsentry/sentry-python/issues/2045)) by [@sentrivana](https://togithub.com/sentrivana) ### [`v1.21.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1210) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.20.0...1.21.0) ##### Various fixes & improvements - Better handling of redis span/breadcrumb data ([#2033](https://togithub.com/getsentry/sentry-python/issues/2033)) by [@antonpirker](https://togithub.com/antonpirker) *Note:* With this release we will limit the description of redis db spans and the data in breadcrumbs represting redis db operations to 1024 characters. This can can lead to truncated data. If you do not want this there is a new parameter `max_data_size` in `RedisIntegration`. You can set this to `None` for disabling trimming. Example for **disabling** trimming of redis commands in spans or breadcrumbs: ```python sentry_sdk.init( integrations=[ RedisIntegration(max_data_size=None), ] ) ``` Example for custom trim size of redis commands in spans or breadcrumbs: ```python sentry_sdk.init( integrations=[ RedisIntegration(max_data_size=50), ] )` ``` - Add `db.system` to redis and SQLAlchemy db spans ([#2037](https://togithub.com/getsentry/sentry-python/issues/2037), [#2038](https://togithub.com/getsentry/sentry-python/issues/2038), [#2039](https://togithub.com/getsentry/sentry-python/issues/2039)) ([#2037](https://togithub.com/getsentry/sentry-python/issues/2037)) by [@AbhiPrasad](https://togithub.com/AbhiPrasad) - Upgraded linting tooling ([#2026](https://togithub.com/getsentry/sentry-python/issues/2026)) by [@antonpirker](https://togithub.com/antonpirker) - Made code more resilient. ([#2031](https://togithub.com/getsentry/sentry-python/issues/2031)) by [@antonpirker](https://togithub.com/antonpirker) ### [`v1.20.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1200) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.19.1...1.20.0) ##### Various fixes & improvements - Send all events to /envelope endpoint when tracing is enabled ([#2009](https://togithub.com/getsentry/sentry-python/issues/2009)) by [@antonpirker](https://togithub.com/antonpirker) *Note:* If you’re self-hosting Sentry 9, you need to stay in the previous version of the SDK or update your self-hosted to at least 20.6.0 - Profiling: Remove profile context from SDK ([#2013](https://togithub.com/getsentry/sentry-python/issues/2013)) by [@Zylphrex](https://togithub.com/Zylphrex) - Profiling: Additionl performance improvements to the profiler ([#1991](https://togithub.com/getsentry/sentry-python/issues/1991)) by [@Zylphrex](https://togithub.com/Zylphrex) - Fix: Celery Beat monitoring without restarting the Beat process ([#2001](https://togithub.com/getsentry/sentry-python/issues/2001)) by [@antonpirker](https://togithub.com/antonpirker) - Fix: Using the Codecov uploader instead of deprecated python package ([#2011](https://togithub.com/getsentry/sentry-python/issues/2011)) by [@antonpirker](https://togithub.com/antonpirker) - Fix: Support for Quart ([#2003](https://togithub.com/getsentry/sentry-python/issues/2003))\` ([#2003](https://togithub.com/getsentry/sentry-python/issues/2003)) by [@antonpirker](https://togithub.com/antonpirker) ### [`v1.19.1`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1191) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.19.0...1.19.1) ##### Various fixes & improvements - Make auto monitoring beat update support Celery 4 and 5 ([#1989](https://togithub.com/getsentry/sentry-python/issues/1989)) by [@antonpirker](https://togithub.com/antonpirker) ### [`v1.19.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1190) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.18.0...1.19.0) ##### Various fixes & improvements - **New:** [Celery Beat](https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html) auto monitoring ([#1967](https://togithub.com/getsentry/sentry-python/issues/1967)) by [@antonpirker](https://togithub.com/antonpirker) The CeleryIntegration can now also monitor your Celery Beat scheduled tasks automatically using the new [Crons](https://blog.sentry.io/2023/01/04/cron-job-monitoring-beta-because-scheduled-jobs-fail-too/) feature of Sentry. To learn more see our [Celery Beat Auto Discovery](https://docs.sentry.io/platforms/python/guides/celery/crons/) documentation. Usage: ```python from celery import Celery, signals from celery.schedules import crontab import sentry_sdk from sentry_sdk.integrations.celery import CeleryIntegration app = Celery('tasks', broker='...') app.conf.beat_schedule = { 'set-in-beat-schedule': { 'task': 'tasks.some_important_task', 'schedule': crontab(...), }, } @signals.celeryd_init.connect def init_sentry(**kwargs): sentry_sdk.init( dsn='...', integrations=[CeleryIntegration(monitor_beat_tasks=True)], # 👈 here environment="local.dev.grace", release="v1.0", ) ``` This will auto detect all schedules tasks in your `beat_schedule` and will monitor them with Sentry [Crons](https://blog.sentry.io/2023/01/04/cron-job-monitoring-beta-because-scheduled-jobs-fail-too/). - **New:** [gRPC](https://grpc.io/) integration ([#1911](https://togithub.com/getsentry/sentry-python/issues/1911)) by [@hossein-raeisi](https://togithub.com/hossein-raeisi) The [gRPC](https://grpc.io/) integration instruments all incoming requests and outgoing unary-unary, unary-stream grpc requests using grpcio channels. To learn more see our [gRPC Integration](https://docs.sentry.io/platforms/python/configuration/integrations/grpc/) documentation. On the server: ```python import grpc from sentry_sdk.integrations.grpc.server import ServerInterceptor server = grpc.server( thread_pool=..., interceptors=[ServerInterceptor()], ) ``` On the client: ```python import grpc from sentry_sdk.integrations.grpc.client import ClientInterceptor with grpc.insecure_channel("example.com:12345") as channel: channel = grpc.intercept_channel(channel, *[ClientInterceptor()]) ``` - **New:** socket integration ([#1911](https://togithub.com/getsentry/sentry-python/issues/1911)) by [@hossein-raeisi](https://togithub.com/hossein-raeisi) Use this integration to create spans for DNS resolves (`socket.getaddrinfo()`) and connection creations (`socket.create_connection()`). To learn more see our [Socket Integration](https://docs.sentry.io/platforms/python/configuration/integrations/socket/) documentation. Usage: ```python import sentry_sdk from sentry_sdk.integrations.socket import SocketIntegration sentry_sdk.init( dsn="___PUBLIC_DSN___", integrations=[ SocketIntegration(), ], ) ``` - Fix: Do not trim span descriptions. ([#1983](https://togithub.com/getsentry/sentry-python/issues/1983)) by [@antonpirker](https://togithub.com/antonpirker) ### [`v1.18.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1180) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.17.0...1.18.0) ##### Various fixes & improvements - **New:** Implement `EventScrubber` ([#1943](https://togithub.com/getsentry/sentry-python/issues/1943)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py) To learn more see our [Scrubbing Sensitive Data](https://docs.sentry.io/platforms/python/data-management/sensitive-data/#event-scrubber) documentation. Add a new `EventScrubber` class that scrubs certain potentially sensitive interfaces with a `DEFAULT_DENYLIST`. The default scrubber is automatically run if `send_default_pii = False`: ```python import sentry_sdk from sentry_sdk.scrubber import EventScrubber sentry_sdk.init( ``` ### ... send_default_pii=False, event_scrubber=EventScrubber(), # this is set by default ) ```` You can also pass in a custom `denylist` to the `EventScrubber` class and filter additional fields that you want. ```python from sentry_sdk.scrubber import EventScrubber, DEFAULT_DENYLIST ```` ### [`v1.17.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1170) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.16.0...1.17.0) ##### Various fixes & improvements - **New:** Monitor Celery Beat tasks with Sentry [Cron Monitoring](https://docs.sentry.io/product/crons/). With this feature you can make sure that your Celery beat tasks run at the right time and see if they where successful or not. > **Warning** > Cron Monitoring is currently in beta. Beta features are still in-progress and may have bugs. We recognize the irony. > If you have any questions or feedback, please email us at crons-feedback@sentry.io, reach out via Discord (#cronjobs), or open an issue. Usage: ```python ``` ### [`v1.16.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1160) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.15.0...1.16.0) ##### Various fixes & improvements - **New:** Add [arq](https://arq-docs.helpmanual.io/) Integration ([#1872](https://togithub.com/getsentry/sentry-python/issues/1872)) by [@Zhenay](https://togithub.com/Zhenay) This integration will create performance spans when arq jobs will be enqueued and when they will be run. It will also capture errors in jobs and will link them to the performance spans. Usage: ```python import asyncio from httpx import AsyncClient from arq import create_pool from arq.connections import RedisSettings import sentry_sdk from sentry_sdk.integrations.arq import ArqIntegration from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT sentry_sdk.init( dsn="...", integrations=[ArqIntegration()], ) async def download_content(ctx, url): session: AsyncClient = ctx['session'] response = await session.get(url) print(f'{url}: {response.text:.80}...') return len(response.text) async def startup(ctx): ctx['session'] = AsyncClient() async def shutdown(ctx): await ctx['session'].aclose() async def main(): with sentry_sdk.start_transaction(name="testing_arq_tasks", source=TRANSACTION_SOURCE_COMPONENT): redis = await create_pool(RedisSettings()) for url in ('https://facebook.com', 'https://microsoft.com', 'https://github.com', "asdf" ): await redis.enqueue_job('download_content', url) class WorkerSettings: functions = [download_content] on_startup = startup on_shutdown = shutdown if __name__ == '__main__': asyncio.run(main()) ``` - Update of [Falcon](https://falconframework.org/) Integration ([#1733](https://togithub.com/getsentry/sentry-python/issues/1733)) by [@bartolootrit](https://togithub.com/bartolootrit) - Adding [Cloud Resource Context](https://docs.sentry.io/platforms/python/configuration/integrations/cloudresourcecontext/) integration ([#1882](https://togithub.com/getsentry/sentry-python/issues/1882)) by [@antonpirker](https://togithub.com/antonpirker) - Profiling: Use the transaction timestamps to anchor the profile ([#1898](https://togithub.com/getsentry/sentry-python/issues/1898)) by [@Zylphrex](https://togithub.com/Zylphrex) - Profiling: Add debug logs to profiling ([#1883](https://togithub.com/getsentry/sentry-python/issues/1883)) by [@Zylphrex](https://togithub.com/Zylphrex) - Profiling: Start profiler thread lazily ([#1903](https://togithub.com/getsentry/sentry-python/issues/1903)) by [@Zylphrex](https://togithub.com/Zylphrex) - Fixed checks for structured http data ([#1905](https://togithub.com/getsentry/sentry-python/issues/1905)) by [@antonpirker](https://togithub.com/antonpirker) - Make `set_measurement` public api and remove experimental status ([#1909](https://togithub.com/getsentry/sentry-python/issues/1909)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py) - Add `trace_propagation_targets` option ([#1916](https://togithub.com/getsentry/sentry-python/issues/1916)) by [@antonpirker](https://togithub.com/antonpirker) - Add `enable_tracing` to default traces_sample_rate to 1.0 ([#1900](https://togithub.com/getsentry/sentry-python/issues/1900)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py) - Remove deprecated `tracestate` ([#1907](https://togithub.com/getsentry/sentry-python/issues/1907)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py) - Sanitize URLs in Span description and breadcrumbs ([#1876](https://togithub.com/getsentry/sentry-python/issues/1876)) by [@antonpirker](https://togithub.com/antonpirker) - Mechanism should default to true unless set explicitly ([#1889](https://togithub.com/getsentry/sentry-python/issues/1889)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py) - Better setting of in-app in stack frames ([#1894](https://togithub.com/getsentry/sentry-python/issues/1894)) by [@antonpirker](https://togithub.com/antonpirker) - Add workflow to test gevent ([#1870](https://togithub.com/getsentry/sentry-python/issues/1870)) by [@Zylphrex](https://togithub.com/Zylphrex) - Updated outdated HTTPX test matrix ([#1917](https://togithub.com/getsentry/sentry-python/issues/1917)) by [@antonpirker](https://togithub.com/antonpirker) - Switch to MIT license ([#1908](https://togithub.com/getsentry/sentry-python/issues/1908)) by [@cleptric](https://togithub.com/cleptric) ### [`v1.15.0`](https://togithub.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#1150) [Compare Source](https://togithub.com/getsentry/sentry-python/compare/1.14.0...1.15.0) ##### Various fixes & improvements - New: Add [Huey](https://huey.readthedocs.io/en/latest/) Integration ([#1555](https://togithub.com/getsentry/sentry-python/issues/1555)) by [@Zhenay](https://togithub.com/Zhenay) This integration will create performance spans when Huey tasks will be enqueued and when they will be executed. Usage: Task definition in `demo.py`: ```python import time from huey import SqliteHuey, crontab import sentry_sdk from sentry_sdk.integrations.huey import HueyIntegration sentry_sdk.init( dsn="...", integrations=[ HueyIntegration(), ], traces_sample_rate=1.0, ) huey = SqliteHuey(filename='/tmp/demo.db') @huey.task() def add_numbers(a, b): return a + b ``` Running the tasks in `run.py`: ```python from demo import add_numbers, flaky_task, nightly_backup import sentry_sdk from sentry_sdk.integrations.huey import HueyIntegration from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT, Transaction def main(): sentry_sdk.init( dsn="...", integrations=[ HueyIntegration(), ], traces_sample_rate=1.0, ) with sentry_sdk.start_transaction(name="testing_huey_tasks", source=TRANSACTION_SOURCE_COMPONENT): r = add_numbers(1, 2) if __name__ == "__main__": main() ``` - Profiling: Do not send single sample profiles ([#1879](https://togithub.com/getsentry/sentry-python/issues/1879)) by [@Zylphrex](https://togithub.com/Zylphrex) - Profiling: Add additional test coverage for profiler ([#1877](https://togithub.com/getsentry/sentry-python/issues/1877)) by [@Zylphrex](https://togithub.com/Zylphrex) - Profiling: Always use builtin time.sleep ([#1869](https://togithub.com/getsentry/sentry-python/issues/1869)) by [@Zylphrex](https://togithub.com/Zylphrex) - Profiling: Defaul in_app decision to None ([#1855](https://togithub.com/getsentry/sentry-python/issues/1855)) by [@Zylphrex](https://togithub.com/Zylphrex) - Profiling: Remove use of threading.Event ([#1864](https://togithub.com/getsentry/sentry-python/issues/1864)) by [@Zylphrex](https://togithub.com/Zylphrex) - Profiling: Enable profiling on all transactions ([#1797](https://togithub.com/getsentry/sentry-python/issues/1797)) by [@Zylphrex](https://togithub.com/Zylphrex) - FastAPI: Fix check for Starlette in FastAPI integration ([#1868](https://togithub.com/getsentry/sentry-python/issues/1868)) by [@antonpirker](https://togithub.com/antonpirker) - Flask: Do not overwrite default for username with email address in FlaskIntegration ([#1873](https://togithub.com/getsentry/sentry-python/issues/1873)) by [@homeworkprod](https://togithub.com/homeworkprod) - Tests: Add py3.11 to test-common ([#1871](https://togithub.com/getsentry/sentry-python/issues/1871)) by [@Zylphrex](https://togithub.com/Zylphrex) - Fix: Don't log whole event in before_send / event_processor drops ([#1863](https://togithub.com/getsentry/sentry-python/issues/1863)) by [@sl0thentr0py](https://togithub.com/sl0thentr0py)Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.