A light weight library to monitor performance and events in production systems.

Counting some event somewhere in your code:

PyCounter’s shortcut decorator will use the function name in it’s output. This can be configured (see Shortcut functions ).

Measurements are done by averaging out a sliding window of 5 minutes. Window size is configurable.

Count the number of times per second a function is executed:

Nice, but is it just that simple?¶

Well, almost (see Moving Parts for a complete answer.) To let the counters report their statistics you need to initialize an instance of the LogReporter:

import pycounters import logging reporter = pycounters . reporters . LogReporter ( logging . getLogger ( "counters" )) pycounters . register_reporter ( reporter ) pycounters . start_auto_reporting ( seconds = 300 )

Once adding this code, all the counters will periodically report their stats to a log named “counters”. Here is an example:

2011-06-03 18:12:44,881 | 9130|1286490432 | counters | INFO | posting 0.589342236519 2011-06-03 18:12:44,888 | 9130|1286490432 | counters | INFO | search 1.47849245866