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 details)

Uploaded Python 2 Python 3

File details

Details for the file django_expvar-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_expvar-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3d186de20d2092312ea170f2e55ee43c6d2ef05e8f034480d5bf4673ac06678e
MD5 69fc0c54c00f207d8378922f778db0b2
BLAKE2b-256 8174e4819c0d891dff6c9e81765d7b2f298d644e395fc670a8b739016249e48a

See more details on using hashes here.

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