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",
...
)
Add the middleware:
MIDDLEWARE = [
...
"django_error_reporting.middleware.ErrorReportingMiddleware",
...
]
Note: to capture user data, middleware needs to be after django.contrib.auth.middleware.AuthenticationMiddleware
.
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.
Utilities
add_event_tag(name, value)
To add an event tag to the data sent to Sentry or DataDog, you need to this function.
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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb804f1f13dcdaf42d09b29da3324d4a5922c13dc06b522639c48f7419180fd0 |
|
MD5 | ad8036ca00febddbc3558d68bcbf7086 |
|
BLAKE2b-256 | f54ee2149e454d569709d804afd5f073528237683c30e7233a8b5c19f6832c71 |
Hashes for django_error_reporting-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1080830c86c324ac1f1d0af533557e1ff7c986e0a2ef1c1b669bdedc37177e20 |
|
MD5 | 2feb0fd5f1d1d2da5bb1ea5c208acea3 |
|
BLAKE2b-256 | b4416381707069a6f6c66683b1ab5654985c913369b436fc26ef8a37ea2216e1 |