Code Monkey home page Code Monkey logo

django-monitoring's Introduction

Django Monitoring

DO NOT USE THIS. Work in progress.

A reusable Django app to monitor all aspects of your webapp.

The idea is to create an app that provides some APIs that can be re-used by any other app.

Let's say you want to create a graph that shows how many users sign up at your site every day.

First you will create a model that can hold this data. django-monitoring will provide some abstract base classes for commonly used model types:

class MonitorUserCount(MonitorCountBase, models.Model):
    pass

Next you will register a new monitor that is connected to that monitor model:

from monitoring import monitor
from myapp.models import MonitorUserCount

monitor.register('user_count', UserRegistrationCount)

Now you can add one count to this monitor anywhere in your code:

from monitoring import monitor

def post_registration__handler(sender, user, *args, **kwargs):
    monitor.add('user_count', 1)

django-monitoring will figure out, that the user_count monitor is connected to the MonitorUserCount model and it will also know that this model is of the type MonitorCountBase which will know how to add one data point to itself. In this case it would just add a row to the table which says that 1 user was added at timezone.now().

Finally django-monitoring provides a view which will show graphs for all connected monitors. I still have to think about how to teach that view which monitors to show, how to render the data and how to filter the data.

The base classes will probably have an attribute which describes the default template but you could easily override those templates for your app.

Installation

To get the latest stable release from PyPi (not yet released!)

$ pip install django-monitoring

To get the latest commit from GitHub

$ pip install -e git+git://github.com/bitmazk/django-monitoring.git#egg=monitoring

Add monitoring to your INSTALLED_APPS

INSTALLED_APPS = (
    ...,
    'monitoring',
)

Add the monitoring URLs to your urls.py

urlpatterns = patterns('',
    ...
    url(r'^monitoring/', include('monitoring.urls')),
)

Don't forget to migrate your database

./manage.py migrate monitoring

Usage

TODO: Describe usage or point to docs. Also describe available settings and templatetags.

Contribute

If you want to contribute to this project, please perform the following steps

# Fork this repository
# Clone your fork
$ mkvirtualenv -p python2.7 django-monitoring
$ python setup.py install
$ pip install -r dev_requirements.txt

$ git co -b feature_branch master
# Implement your feature and tests
$ git add . && git commit
$ git push -u origin feature_branch
# Send us a pull request for your feature branch

django-monitoring's People

Contributors

mbrochh avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.