Skip to main content

django-monsieur

monsieur is a Django app designed to track/monitor/query arbitrary events over periods of time.

Usage

Once installed (instructions below), simply import monsieur and start logging events.

# views.py
import monsieur

def handler(request):
    try:
        handle_request(request)
    except Exception as e:
        # log exception to monsieur and add os/browser attributes
        os, browser = parse_ua(request.META.get('HTTP_USER_AGENT'))
        name = e.message or 'Unknown exception in handler()'
        monsieur.incr(name, 1, 'view errors', os=os, browser=browser)

monsieur has a query system similar to Django’s querysets:

>>> import monsieur
>>> q = monsieur.Q.tag('view errors')
>>> q = q.filter(os='windows')
>>> q = q.granularity('hour')
>>> q.eval()
{'integer division or modulo by zero': [{'dt': datetime.datetime(2013, 1, 7, 20, 0, 0, 0), 'count': 1}, ...]}

Q constructors

Q.tag(x)        # x = TAG | [TAG1, TAG2, ...]

Q.events(x)     # x = NAME | [NAME1, NAME2, ...]

Q methods

q.filter(**kwargs)   # key=value to filter by

q.start(x)           # x = datetime.datetime

q.end(x)             # x = datetime.datetime

q.granularity(x)     # x = 'minute' | 'hour' | 'day'

Q evaluation methods

q.names()

q.eval()

Download files

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

Source Distribution

django-monsieur-0.0.1.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file django-monsieur-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-monsieur-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f3d8f2ce61ca9aae39a5b2021aa00fa836fa7a3f26731ca2e5a435f841d4eac8
MD5 a8b3c7c4c3f58f2c49e6363dc2adc271
BLAKE2b-256 106180c97aecf18d5eab922bcf7e86e5e1804490c77f0292a7dff1f4cdf664b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page