DataDog and Sentry error reporting for Django
Project description
Django Error Reporting
Global error reporting framework for Django, Sentry, and DataDog
Requirements
- Python >= 3.6
- django >= 2.2.9
- sentrysdk >= 1.5.4
- ddtrace >=0.59.0
Installation
Install django-error-reporting
:
pip install django-error-reporting
Add it to your INSTALLED_APPS
:
INSTALLED_APPS = (
...
"django_error_reporting",
...
)
Settings
The following are settings available and their defaults:
ENABLE_DATADOG_INTEGRATION
Indicates whether DataDog integrations should be processed.
Default: True
ENABLE_SENTRY_INTEGRATION
Indicates whether Sentry integrations should be processed.
Default: True
On Ready
When the app is loaded (i.e., ready()
is called), it will do the following:
- Load default settings into the project settings
- Add
ErrorReportingMiddleware
tosettings.MIDDLEWARE
. - If DataDog integration is enabled, add
DataDogExceptionMiddleware
tosettings.MIDDLEWARE
.
Middleware
ErrorReportingMiddleware
This middleware adds event tags (using add_event_tag
) for each request.
It also adds a trace_id
to the session which is a unique identifier for a request. If using AWS load balancers, it will use the trace ID from it; otherwise, uuid.uuid4()
is used.
To add app-specific tags, you can set a callback with ERROR_REPORTING_TAGGING_CALLBACK
which should accept a Request
instance and the add_event_tag
function as arguments.
DataDogExceptionMiddleware
When an exception is captured, this middleware will set the appropriate span tags on the root span of the trace.
This middleware should be added as late as possible.
Utilities
add_event_tag(name, value, dd_scope=None)
Adds an event tag to the data sent to Sentry and/or DataDog.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-error-reporting-0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 054d1b3e1ea88fb55b898c8f3c2b6b608891a6cddd959c3c77b893caab71a121 |
|
MD5 | 903ebb895689816a49ca50e2968c4347 |
|
BLAKE2b-256 | f30db8bd5764160e7d5c62e4e38feb84a0b2434733a03098cd4f9bf4f73b92da |
Hashes for django_error_reporting-0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5d1eba6be4f5394279119029fff1ab56d46bee1522eb757582367c950ffc32c |
|
MD5 | bb91141a59b131e3fd81683ea8eb0a9c |
|
BLAKE2b-256 | b4f943d279e6cea623abb7b9e60a14ae9682cbeac6f0017eecb221f8b4e677d5 |