Skip to main content

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

django-error-reporting-0.4.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

django_error_reporting-0.4-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page