Skip to content

Commit 70e336b

Browse files
committed
Merge branch 'master' into sentry-sdk-2.0
2 parents 86bbf93 + 411c9f3 commit 70e336b

File tree

2 files changed

+111
-5
lines changed

2 files changed

+111
-5
lines changed

CHANGELOG.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,99 @@ _Plus 2 more_
440440
- Passing a function to `sentry_sdk.init`'s `transport` keyword argument has been deprecated. If you wish to provide a custom transport, please pass a `sentry_sdk.transport.Transport` instance or a subclass.
441441
- The parameter `propagate_hub` in `ThreadingIntegration()` was deprecated and renamed to `propagate_scope`.
442442

443+
## 1.45.0
444+
445+
This is the final 1.x release for the forseeable future. Development will continue on the 2.x release line. The first 2.x version will be available in the next few weeks.
446+
447+
### Various fixes & improvements
448+
449+
- Allow to upsert monitors (#2929) by @sentrivana
450+
451+
It's now possible to provide `monitor_config` to the `monitor` decorator/context manager directly:
452+
453+
```python
454+
from sentry_sdk.crons import monitor
455+
456+
# All keys except `schedule` are optional
457+
monitor_config = {
458+
"schedule": {"type": "crontab", "value": "0 0 * * *"},
459+
"timezone": "Europe/Vienna",
460+
"checkin_margin": 10,
461+
"max_runtime": 10,
462+
"failure_issue_threshold": 5,
463+
"recovery_threshold": 5,
464+
}
465+
466+
@monitor(monitor_slug='<monitor-slug>', monitor_config=monitor_config)
467+
def tell_the_world():
468+
print('My scheduled task...')
469+
```
470+
471+
Check out [the cron docs](https://docs.sentry.io/platforms/python/crons/) for details.
472+
473+
- Add Django `signals_denylist` to filter signals that are attached to by `signals_spans` (#2758) by @lieryan
474+
475+
If you want to exclude some Django signals from performance tracking, you can use the new `signals_denylist` Django option:
476+
477+
```python
478+
import django.db.models.signals
479+
import sentry_sdk
480+
481+
sentry_sdk.init(
482+
...
483+
integrations=[
484+
DjangoIntegration(
485+
...
486+
signals_denylist=[
487+
django.db.models.signals.pre_init,
488+
django.db.models.signals.post_init,
489+
],
490+
),
491+
],
492+
)
493+
```
494+
495+
- `increment` for metrics (#2588) by @mitsuhiko
496+
497+
`increment` and `inc` are equivalent, so you can pick whichever you like more.
498+
499+
- Add `value`, `unit` to `before_emit_metric` (#2958) by @sentrivana
500+
501+
If you add a custom `before_emit_metric`, it'll now accept 4 arguments (the `key`, `value`, `unit` and `tags`) instead of just `key` and `tags`.
502+
503+
```python
504+
def before_emit(key, value, unit, tags):
505+
if key == "removed-metric":
506+
return False
507+
tags["extra"] = "foo"
508+
del tags["release"]
509+
return True
510+
511+
sentry_sdk.init(
512+
...
513+
_experiments={
514+
"before_emit_metric": before_emit,
515+
}
516+
)
517+
```
518+
519+
- Remove experimental metric summary options (#2957) by @sentrivana
520+
521+
The `_experiments` options `metrics_summary_sample_rate` and `should_summarize_metric` have been removed.
522+
523+
- New normalization rules for metric keys, names, units, tags (#2946) by @sentrivana
524+
- Change `data_category` from `statsd` to `metric_bucket` (#2954) by @cleptric
525+
- Accessing `__mro__` might throw a `ValueError` (#2952) by @sentrivana
526+
- Suppress prompt spawned by subprocess when using `pythonw` (#2936) by @collinbanko
527+
- Handle `None` in GraphQL query #2715 (#2762) by @czyber
528+
- Do not send "quiet" Sanic exceptions to Sentry (#2821) by @hamedsh
529+
- Implement `metric_bucket` rate limits (#2933) by @cleptric
530+
- Fix type hints for `monitor` decorator (#2944) by @szokeasaurusrex
531+
- Remove deprecated `typing` imports in crons (#2945) by @szokeasaurusrex
532+
- Make `monitor_config` a `TypedDict` (#2931) by @sentrivana
533+
- Add `devenv-requirements.txt` and update env setup instructions (#2761) by @arr-ee
534+
- Bump `types-protobuf` from `4.24.0.20240311` to `4.24.0.20240408` (#2941) by @dependabot
535+
- Disable Codecov check run annotations (#2537) by @eliatcodecov
443536

444537
## 1.44.1
445538

tests/integrations/celery/test_celery.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,24 @@ def dummy_task(self):
415415
@pytest.mark.parametrize("newrelic_order", ["sentry_first", "sentry_last"])
416416
def test_newrelic_interference(init_celery, newrelic_order, celery_invocation):
417417
def instrument_newrelic():
418-
import celery.app.trace as celery_mod
419-
from newrelic.hooks.application_celery import instrument_celery_execute_trace
420-
421-
assert hasattr(celery_mod, "build_tracer")
422-
instrument_celery_execute_trace(celery_mod)
418+
try:
419+
# older newrelic versions
420+
from newrelic.hooks.application_celery import (
421+
instrument_celery_execute_trace,
422+
)
423+
import celery.app.trace as celery_trace_module
424+
425+
assert hasattr(celery_trace_module, "build_tracer")
426+
instrument_celery_execute_trace(celery_trace_module)
427+
428+
except ImportError:
429+
# newer newrelic versions
430+
from newrelic.hooks.application_celery import instrument_celery_app_base
431+
import celery.app as celery_app_module
432+
433+
assert hasattr(celery_app_module, "Celery")
434+
assert hasattr(celery_app_module.Celery, "send_task")
435+
instrument_celery_app_base(celery_app_module)
423436

424437
if newrelic_order == "sentry_first":
425438
celery = init_celery()

0 commit comments

Comments
 (0)