question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sentry.contrib.flask is a bit slow

See original GitHub issue

We’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:

discord_api___datadog

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:open
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dcramercommented, May 8, 2017

@orarbel you are not using the current iteration of raven-python

0reactions
orarbelcommented, May 8, 2017

Unfortunately when I tried the script I got this crash:

AttributeError services.sentry_service in attach_context
fatal 'Client' object has no attribute 'transaction'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Monitoring Performance and Errors in a Django Application ...
In this tutorial, we'll show how to add Sentry to a Django application so you can track and resolve any errors or performance...
Read more >
How to propagate errors in python rq worker tasks to Sentry
I have a Flask app with Sentry error tracking. Now I created some tasks with rq , but their errors do not show...
Read more >
Flask Documentation - Read the Docs
at the same time, they will slow down as each write happens sequentially. Small appli- ... from raven.contrib.flask import Sentry.
Read more >
Sentry (@getsentry) / Twitter
Instacart built a custom integration with Sentry, and you can too. ... Have you started your #Hacktoberfest contribution yet? ... "Slow is smooth....
Read more >
Bug listing with status CONFIRMED as at 2022/12/20 18:46:38
... -s is slow with a lot of results" status:CONFIRMED resolution: severity: ... Bug:292295 - "New package: dev-lang/clojure-contrib" status:CONFIRMED ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found