You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
I would also love to have this configurable. On signal or sender level. What I additionally noticed was that I am not able to easily see the connected receivers of a signal by calling
e.g. post_save._live_receivers(AnyModel) as they are wrapped now. But this should be solvable by using functools.wraps to update the wrapper function : signature was fixed in #1700
How do you use Sentry?
Self-hosted/on-premise
Version
1.12.1
Steps to Reproduce
Updated
sentry-sdk
from1.9.8
to1.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 ofImageField
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 anyImageField
).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:
![image](https://user-images.githubusercontent.com/7027722/211202958-981bed57-0c10-4549-a83f-60e6d101ba55.png)
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:
The text was updated successfully, but these errors were encountered: