We use Sentry to monitor errors within our Django applications. It’s an excellent tool: you should use it.
Regrettable however, we sometimes need to SSH into a server within our platform and use Django’s shell to explore or adjust data. However, by default, exceptions from these sessions are captured up Sentry and appear in the dashboard.
This isn’t helpful as such errors are not application problems per se and just add noise. We want Sentry to ignore these exceptions.
To prevent these errors being captured, the solution is to use a custom Sentry
client class with an overridden
should_capture method that ignores errors
triggered from a shell session.
Here’s an example:
Plumb this in by adding a
SENTRY_CLIENT setting specifying the module path to