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
this class:
Problem solved.
- Estimating cost per dbt model in Databricks
- Automating secrets management with 1Password Connect
- Understanding how mypy follows imports
- Optimizing AWS Stream Consumer Performance
- Sharing Power Updates using Amazon EventBridge Pipes
- Using formatters and linters to manage a large codebase
- Our pull request conventions
- Patterns of flakey Python tests
- Integrating Asana and GitHub
- Durable database transactions in Django
- Python interfaces a la Golang
- Beware changing the "related name" of a Django model field
- Our in-house coding conventions
- Recommended Django project structure
- Improving accessibility at Octopus Energy
- Django, ELB health checks and continuous delivery
- Organising styles for a React/Django hybrid
- Testing for missing migrations in Django
- Hello world, would you like to join us?