• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 13 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Performance logging middlware and analysis tools for Django

A simple django middleware that logs request times using the Django 1.3 logging support, and a management command to analyze the resulting data. Once installed and configured you can run a command line these:

python manage.py analyze_timelog
python manage.py analyze_timelog --noreverse

And generate useful tabular data like this:

+--------------------------+--------+--------+-------+---------+---------+-------+-----------------+
| view                     | method | status | count | minimum | maximum | mean  | stdev           |
+--------------------------+--------+--------+-------+---------+---------+-------+-----------------+
| boxes.viewsBoxDetailView | GET    | 200    | 9430  | 0.14    | 0.28    | 0.21  | 0.0700037118541 |
+--------------------------+--------+--------+-------+---------+---------+-------+-----------------+
| boxes.viewsBoxListView   | GET    | 200    | 66010 | 0.17    | 0.28    | 0.232 | 0.0455415351076 |
+--------------------------+--------+--------+-------+---------+---------+-------+-----------------+
| django.views.staticserve | GET    | 200    | 61295 | 0.00    | 0.02    | 0.007 | 0.0060574669888 |
+--------------------------+--------+--------+-------+---------+---------+-------+-----------------+

This project was heavily influenced by the Rails Request log analyzer.

Installation

pip install django-timelog

Once installed you need to do a little configuration to get things working. First add the middleware to your MIDDLEWARE_CLASSES in your settings file.

MIDDLEWARE_CLASSES = (
  'timelog.middleware.TimeLogMiddleware',

Next add timelog to your INSTALLED_APPS list. This is purely for the management command discovery.

INSTALLED_APPS = (
  'timelog',

Then configure the logger you want to use. This really depends on what you want to do, the django 1.3 logging setup is pretty powerful. Here’s how I’ve got logging setup as an example:

TIMELOG_LOG = '/path/to/logs/timelog.log'

LOGGING = {
  'version': 1,
  'formatters': {
    'plain': {
      'format': '%(asctime)s %(message)s'},
    },
  'handlers': {
    'timelog': {
      'level': 'DEBUG',
      'class': 'logging.handlers.RotatingFileHandler',
      'filename': TIMELOG_LOG,
      'maxBytes': 1024 * 1024 * 5,  # 5 MB
      'backupCount': 5,
      'formatter': 'plain',
    },
  },
  'loggers': {
    'timelog.middleware': {
      'handlers': ['timelog'],
      'level': 'DEBUG',
      'propogate': False,
     }
  }
}

Lastly, if you have particular URIs you wish to ignore you can define them using basic regular expressions in the TIMELOG_IGNORE_URIS list in settings.py:

TIMELOG_IGNORE_URIS = (
    '^/admin/',         # Ignores all URIs beginning with '/admin/'
    '^/other_page/$',   # Ignores the URI '/other_page/' only, but not '/other_page/more/'.
    '.jpg$',            # Ignores all URIs ending in .jpg
)

More Repositories

1

vagrantboxes-heroku

Repository for http://www.vagrantbox.es
1,281
star
2

garethr-docker

Puppet module for managing docker
Ruby
397
star
3

puppet-module-skeleton

A pretty opinionated skeleton for writing your own puppet modules
HTML
312
star
4

kubetest

Write unit tests for your Kubernetes configurations
Go
310
star
5

kubernetes-json-schema

A set of JSON schemas for various Kubernetes versions, extracted from the OpenAPI definitions
250
star
6

pentesting-playground

Code for installing various security minded tools onto Vagrant powered virtual machines
Puppet
172
star
7

django-test-extensions

A set of custom assertions and examples for use testing django applications
Python
145
star
8

serf-master

A small python framework for writing Serf handlers
Python
126
star
9

django-project-templates

A set of Paster templates for Django projects, including a fabric deployment script
Python
124
star
10

multi-stage-build-example

Example repository to accompany my talk at Velocity 2018
Makefile
119
star
11

logstash-patterns

A collection of grok patterns for use with logstash
Ruby
98
star
12

cloth

EC2 tasks for Fabric
Python
97
star
13

packer-serverspec-example

Using Serverspec tests to verify images built using Packer
Ruby
96
star
14

prodder

An opinionated test suite focused on generally applicable web application security rules
Ruby
94
star
15

docker-label-inspector

Docker Label Inspector is a tool to help ensure you're providing your Docker images with the metadata they will need out in the wilds of the internet.
Python
80
star
16

ansible-provisioner

A Digital Ocean specific provisioning and orchestration tool built around Ansible
Python
76
star
17

zapr

Easy to use command line security scanner
Ruby
59
star
18

appengine-image-host

Simple image resizing and hosting application
Python
45
star
19

hiera-etcd

A hiera backend for use with the etcd distributed configuration store
Ruby
44
star
20

policykit

A set of utilities and classes for working with Open Policy Agent based tools, including Gatekeeper and Conftest
Python
39
star
21

ruby-vagrantboxes

Ruby gem for interacting with the vagrantbox.es api from inside vagrant
Ruby
37
star
22

riemann-vagrant

A vagrantfile and puppet setup to get playing with Riemann quickly
Ruby
37
star
23

packages

Scripts for building and maintaining a debian package repository using Vagrant
CSS
37
star
24

kubernetes-webhook-examples

Python examples of mutating and validating kubernetes webhook admission controllers
Python
36
star
25

puppet-docker-example

An example of using the Puppet Docker module to manage containers, including Consul for service discovery
Ruby
35
star
26

Asteroid

A simple web interface for running scripts and recording the results
Python
35
star
27

django-clue

A collection of useful development middleware for Django packaged under a custom runserver command
Python
33
star
28

garethr-key_value_config

Puppet type and providers for managing configuration in key/value stores
Ruby
30
star
29

puppet-docker-swarm-example

An example using Puppet to launch a Swarm cluster using Consul
Ruby
30
star
30

sinatra-hello-world

A Hello World style application demonstrating the Sinatra Ruby framework
Ruby
28
star
31

garethr-kubernetes

Puppet types and provider for managing Pods, ReplicationControllers, Services and more in Kubernetes
Ruby
28
star
32

appengine-imified

Example of providing an Instant Messaging interface to App Engine application
Python
24
star
33

web-puppet

A tiny ruby rack application which exposes the data from puppet as JSON over HTTP
Ruby
23
star
34

openshift-json-schema

A set of JSON schemas for various OpenShift versions, extracted from the OpenAPI definitions
Shell
23
star
35

django-googlecalendar

A Django application which provides a front end to one or more Google Calendars
23
star
36

capistrano-puppet

Get capistrano hosts from puppet
Ruby
21
star
37

bolt

A script runner
Ruby
19
star
38

localbuilder

Python script for monitoring a given directory for changes and running a command when something changes
Python
19
star
39

pycnab

Python library for manipulating Cloud Native Application Bundles
Python
19
star
40

garethr-iaas

Experiment with Puppet types and providers for managing virtual machines from an IaaS
Ruby
17
star
41

appengine-bugs

Super simple issue tracker for Google AppEngine, the code behind GitBug
Python
16
star
42

garethr-riemann

Puppet module for Riemann, published on the Puppet Forge
Ruby
16
star
43

snyk-sbom-examples

Examples of using Snyk's SBOM APIs.
Python
15
star
44

sensu-playground

A demo of a vagrant powered multi-node sensu setup, using the sensu puppet module
Puppet
15
star
45

docker-app-cnab-examples

Examples originally for the KubeCon workshop at Microsoft Reactor
Makefile
14
star
46

appengine-uptime

site monitoring utility hosted on Google App Engine
Python
14
star
47

helm-travis-testing-example

Smarty
14
star
48

kubernetes-tools

Python
13
star
49

devopsweekly

Content for the Devops Weekly site
HTML
12
star
50

snyky

A known vulnerable Flask app with an excessive amount of automated testing
Open Policy Agent
12
star
51

tk-demo-puppet

A working example of using Test Kitchen for integration testing of puppet manifests and modules
Ruby
12
star
52

librarian-puppet-vagrant

Vagrant middleware to run librarian puppet before each vagrant up and vagrant provision
Ruby
12
star
53

jenkins-build-list

A very simple Clojure/Noir application which hits the Jenkins API and lists recent builds for a particular job.
Clojure
12
star
54

docker-spec-example

An example of testing docker image builds
Ruby
12
star
55

snyk-tekton

A set of Tekton Tasks for using Snyk to check for vulnerabilities in your pipelines
HTML
11
star
56

booky

script to build compile a book from text file
Python
11
star
57

puppet-swagger-generator

Generate Puppet types and providers from Swagger specifications
Ruby
11
star
58

snykctl

A CLI tool for interacting with the Snyk API.
Crystal
11
star
59

appengine-queue

Simple Queue for App Engine
Python
10
star
60

garethr-kibana

Puppet module to install and configure the kibana logstash interface
Puppet
10
star
61

nginx-json-proxy

An experiment with openresty, lua and nginx
Nginx
10
star
62

chef-repo

Personal cookbooks
Ruby
10
star
63

appengine-books

AppEngine book listing webservice, web site and admin
Python
10
star
64

vagrant-cucumber-host

Vagrant plugin to run cucumber acceptance tests for Vagrant boxes
Ruby
10
star
65

garethr-diamond

Puppet module for the Diamond stats collection daemon
Ruby
9
star
66

cloud-native-tools

A database of activity around various Cloud Native tools
Makefile
9
star
67

gmetric-web

Simple HTTP interface for adding custom time metrics to Ganglia.
Python
9
star
68

serverspec-puppetdb

Example using PuppetDB to generate Serverspec tests
Ruby
9
star
69

garethr-nginx

A very un-opinionated nginx module for Puppet which focuses on installation and NOT configuration
Ruby
9
star
70

dockerfilepp

Library for writing your own Dockerfile pre-processors
Go
8
star
71

urltest

A simple DSL for writing url based tests for WSGI applications
Python
8
star
72

garethr-graphite

Puppet module for the Graphite monitoring tool
Puppet
8
star
73

snyksh

An interactive shell for exploring the Snyk API
Python
8
star
74

garethr-erlang

Puppet module for managing erlang from official package repository
Ruby
7
star
75

web-facter

Expose facts from Facter as JSON over HTTP
Ruby
7
star
76

findcve

Find CVEs from a list of packages in different formats
Python
7
star
77

dockerfilepp-labels

A dockerfile pre-processor for adding dynamic labels
Go
7
star
78

appengine-seller

Sample App Engine integration with PayPal
Python
7
star
79

epydoc-themes

Application to support alternative stylesheets for epydoc
7
star
80

digitalocean-expect

Experiments in testing an IaaS
Clojure
7
star
81

fixmysite

Like FixMyStreet but for Websites, or like GetSatisfaction but for the UK Government Online
Python
7
star
82

garethr-mirageos

Puppet module to install Mirage and it's dependencies
Ruby
7
star
83

puppet-mesos-example

An example of using Puppet to manage a Mesos, Chronos and Marathon cluster
Ruby
7
star
84

garethr-digitalocean

Puppet module to manage droplets on digitalocean IaaS
Ruby
7
star
85

lastbot

A simple search bot for last.fm created during the last.fm hackday
Python
7
star
86

django-http-debug

Simple HTTP logging server, useful for debugging HTTP clients of various types
Python
6
star
87

garethr-sysdig

Puppet module for installing sysdig
Ruby
6
star
88

inboxer

Putting the web in your inbox
Ruby
6
star
89

appengine-template

Quick start template for App Engine projects based on webapp
6
star
90

puppetdb-expect

Experiment writing tests against data in PuppetDB
Clojure
6
star
91

do-test-kitchen

An example, ideal for a CI environment, of using the Test Kitchen Digital Ocean driver and the new shell provisioner
Ruby
6
star
92

docker-applications

A set of example Docker Apps
6
star
93

django-train

Django blogging application based around generic views, flatpages and tagging
Python
5
star
94

django-linklist

Django application for managing a set of ordered lists of links
Python
5
star
95

knb

Proof-of-concept Knative Build user interface
Python
5
star
96

dockerfilepp-puppet

A small experiment in Dockerfile pre-processing
Makefile
5
star
97

jruby-embedded-jetty

Simple example of creating an executable war file with an embedded jetty
Ruby
5
star
98

graylogtail

Use logtail to push log files into Graylog2
Python
5
star
99

gatling-demo

Simple demo of using Gatling assertions
Scala
5
star
100

nash

Nagios dashboard
Ruby
5
star