-
Notifications
You must be signed in to change notification settings - Fork 554
Description
How do you use Sentry?
Self-hosted/on-premise
Version
1.12.1
Steps to Reproduce
Updated sentry-sdk
from 1.9.8
to 1.12.1
.
Expected Result
Overall project performance not changed
Actual Result
Performance decreased for about 25%.
Looks like instrumentation of some django signals (#1526) brought some overhead.
In my specific example, I've used https://github.com/matthewwithanm/django-imagekit for thumbnails generation. And this lib uses post_init
signal to track changes of ImageField
values.
For cases when there is about 1000 instances in response of DRF API method, post_init
handler is called for a lot of times (even for models that actually does not have any ImageField
). imagekit
itself implements a fast check if handler should be called. However, looks like instrumentation of this slow down overall time of response.
See screenshots with example request. The first one is with commented out patch_signals
call:
The second is with enabled signals instrumentation:
I think that sentry option that allow to disable instrumentation of some specific signals/receivers will allow to solve this problem. Or maybe option that will allow to disable specific instrumentation.
P.S. I used following monkey-patch to disable signals instrumentation and restore previous performance:
from sentry_sdk.integrations import django
django.patch_signals = lambda: None
sentry_sdk.init(
"integrations": [django.DjangoIntegration()],
"dsn": "dsn",
)