Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

simple Django middleware for submitting timings and exceptions to Datadog.

Project description

# Django Datadog

* A simple Django middleware for submitting timings and exceptions to Datadog.
* A helper class, Stats, that creates an API and Statsd connection to Datadog from Django settings

## Installation

Download the code into your project and install it.

git clone git://
cd django-datadog
python install

Add `djdatadog` to your list of installed apps.

INSTALLED_APPS += ('djdatadog')

Add the following configuration to your projects' `` file:

DATADOG_API_KEY = "apikey"
DATADOG_APP_KEY = "appkey"
DATADOG_APP_NAME = "appname" #name your metrics will be tagged with
DATADOG_HOST = "yourddhost" #for statsd metrics
DATADOG_PORT = "8125" #for statsd metrics

The API and app keys can be found at

Add the Datadog request handler to your middleware in ``.

MIDDLEWARE_CLASSES += ('djdatadog.middleware.DatadogMiddleware')

## Usage

### Stats class

from djdatadog.helpers import Stats

s = Stats()
s.increment("my_other_metric", 4, ["tag1", "tag2"])

For information on the statsd interface, see the [Datadog Python Client documentation](

### Middleware
Once the middlewhere installed, you'll start receiving events in your Datadog
stream in the case of an app exception. Here's an example:

![example django exception](

You will also have new timing metrics available:

- `my_app.request_time.{avg,max,min}`
- `my_app.errors.500`
- `my_app.errors.404`
- `my_app.errors.403`
- `my_app.errors.405`
- `my_app.errors.410`

Metrics are tagged with `path:/path/to/view`

Note: `my_app` will be replaced by whatever value you give for `DATADOG_APP_NAME`.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-datadog, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-datadog-1.0.1.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page