sentry.contrib.flask is a bit slow
See original GitHub issueWe’re switching to Sentry for exception logging and noticed that under the default configuration, raven.contrib.flask.Sentry
ended up adding A LOT of overhead to basic request handling.
I’ve since rewrote a bit of it to do context gathering more lazily, and have noticed some dramatic results.
Before I pull these changes out into a fork, I’m wondering if anyone would be interested in seeing these upstreamed.
Here’s a graph:
Essentially, we observed a net of 20% CPU increase on our API workers just by using Sentry with the stock config.
The optimization was actually really simple. We just deferred computing context until an exception is actually attempted to be captured. We also added a context_hook
mechanism that would let you provide your own lazy context gatherer (we use this to attach tags)
The code is here: https://gist.github.com/jhgg/58c0387aac558e1cca9505bf779dfb5b
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
@orarbel you are not using the current iteration of raven-python
Unfortunately when I tried the script I got this crash: