Basic stats logger that increment counts. You can plot these as COUNTER or DERIVED (RRD) or apply derivative (graphite) except for opened, which tracks the currently opened connections.
Usage:
>>> pool = ConnectionPool(...)
>>> stats_logger = StatsLogger()
>>> pool.add_listener(stats_logger)
>>>
>>> # use the pool for a while...
>>> import pprint
>>> pprint.pprint(stats_logger.stats)
{'at_max': 0,
'checked_in': 401,
'checked_out': 403,
'created': {'failure': 0, 'success': 0},
'disposed': {'failure': 0, 'success': 0},
'failed': 1,
'list': 0,
'opened': {'current': 2, 'max': 2},
'recycled': 0}
Get your stats as stats_logger.stats and push them to your metrics system.
Reset all counters to 0