Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Memory Mapped Stats Tools
JavaScript Python Shell Other
Failed to load latest commit information.
docs Only include a partial list of changes in the readme & long description
examples
mmstats mmstats "Better Off Thread" 0.8.0
tests Safety check
.gitignore Ignore more virtualenv directories
.travis.yml Let's try this travis thing
AUTHORS.rst Update CHANGES and AUTHORS for 0.8.0 release
CHANGES.rst Update CHANGES and AUTHORS for 0.8.0 release
LICENSE BSD License
MANIFEST.in Nothing like forgetting to include a file in an sdist to break a release
README.rst Admit the sad truth: development has stalled
TODO.rst Refactor and cleanup docs
run_flask_example Make sure dependencies are instaleld for sample flask app
setup.py Only include a partial list of changes in the readme & long description

README.rst

Documentation | Package | Code

https://secure.travis-ci.org/schmichael/mmstats.png?branch=master

Not under active development

About

Mmstats is a way to expose and read diagnostic values and metrics for applications.

Think of mmstats as /proc for your application and the readers as procps utilities.

This project is a Python implementation, but compatible implementations can be made in any language (see Goals).

Discuss at https://groups.google.com/group/python-introspection

Goals

  • Separate publishing/writing from consuming/reading tools
  • Platform/language independent (a Java writer can be read by a Python tool)
  • Predictable performance impact for writers via:
    • No locks (1 writer per thread)
    • No syscalls (after instantiation)
    • All in userspace
    • Reading has no impact on writers
  • Optional persistent (writer can sync anytime)
  • 1-way (Publish/consume only; mmstats are not management extensions)

Usage

Requirements

CPython 2.6 or 2.7 (Windows is untested)

PyPy (only tested in 1.7, should be faster in 1.8)

Using

  1. easy_install mmstats or pip install mmstats or if you've downloaded the source: python setup.py install
  2. Then in your Python project create a sublcass of mmstats.MmStats like
import mmstats

class WebStats(mmstats.MmStats):
    status2xx = mmstats.CounterField(label='status.2XX')
    status3xx = mmstats.CounterField(label='status.3XX')
    status4xx = mmstats.CounterField(label='status.4XX')
    status5xx = mmstats.CounterField(label='status.5XX')
    last_hit = mmstats.DoubleField(label='timers.last_hit')
  1. Instantiate it once per process: (instances are automatically thread local)
webstats = WebStats(label_prefix='web.stats.')
  1. Record some data:
if response.status_code == 200:
    webstats.status2xx.inc()

webstats.last_hit = time.time()
  1. Run slurpstats to read it
  2. Run mmash to create a web interface for stats
  3. Run pollstats -p web.stats.status 2XX,3XX,4XX,5XX /tmp/mmstats-* for a vmstat/dstat like view.
  4. Did a process die unexpectedly and leave around a stale mmstat file? cleanstats /path/to/mmstat/files will check to see which files are stale and remove them.
Something went wrong with that request. Please try again.