Skip to main content

.

Project description

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

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-monsieur-0.0.2.tar.gz (5.4 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-monsieur-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5ed613f558b44c43f6159decdf14cc9092d9adc909fa209aa29f5234fc895f9e
MD5 d341a1539f48798e8696ea34d2c90f9c
BLAKE2b-256 2b49ca09d76c45cac3f8ab68e2903a328706297181c44e71fbea3e0880cc4780

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page