Skip to main content

Django expvar endpoint

Project description

[![Build Status](https://travis-ci.org/thraxil/django-expvar.svg?branch=master)](https://travis-ci.org/thraxil/django-expvar)
[![Coverage Status](https://coveralls.io/repos/github/thraxil/django-expvar/badge.svg?branch=master)](https://coveralls.io/github/thraxil/django-expvar?branch=master)

django-expvar
==============

[expvar](https://golang.org/pkg/expvar/) compatible endpoint for django

`pip install django-expvar`, add `expvar` to `INSTALLED_APPS` and add
to your `urls.py`:

```
from expvar.views import ExpVarView

...

url('^debug/vars$', ExpVarView.as_view(), name='expvar'),
...
```

Then, accessing `/debug/vars` on your app will return a JSON dict with
the exposed variables, which you can use for monitoring, debugging,
etc.

By default, `expvar` reports commandline arguments and some basic
memory stats, just like the Go package. (currently, the particular
memory stats don't match up with what Go reports. That's being worked
on so tools like [expvarmon](https://github.com/divan/expvarmon) can
be used out of the box, but the Python and Go runtimes are not exactly
identical...)

You can also easily expose other variables through the expvar
endpoint. In your django app, just add a `vars.py` file with some
classes that subclass `expvar.ExpVar` like so:

```
import expvar


class Example(expvar.ExpVar):
name = 'example'

def value(self):
return 42
```

In your django settings, you can optionally specify a `EXPVAR_SKIP`
variable with a list of apps to ignore (ie, any `vars.py` files in
those apps will be ignored).

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

django_expvar-0.1.0-py2.py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 2 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