Permalink
Browse files

More documentation for StatsLogger

  • Loading branch information...
1 parent 7df4c01 commit b5512d5516a00a00d912168e7f33ca8ad2a6b9d1 @thobbs thobbs committed Jul 24, 2012
Showing with 31 additions and 10 deletions.
  1. +5 −0 doc/api/pycassa/logging/pool_stats_logger.rst
  2. +26 −10 pycassa/logging/pool_stats_logger.py
@@ -0,0 +1,5 @@
+:mod:`pycassa.logging.pool_stats_logger` -- Connection Pool Stats
+=================================================================
+
+.. automodule:: pycassa.logging.pool_stats_logger
+ :members:
@@ -21,16 +21,32 @@ def wrapped(self, *args, **kwargs):
class StatsLogger(object):
"""
- Basic stats logger, just increment counts, you can then plot 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)
-
- get your stats by calling stats_logger.stats and push them to your metrics system
+ 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(pool.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.
"""
def __init__(self):

0 comments on commit b5512d5

Please sign in to comment.