Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add setup.py and add usage notes to readme

  • Loading branch information...
commit ad62d1168727542ac30cafb4a4954389c10172c1 1 parent cf96234
@schmichael authored
Showing with 48 additions and 0 deletions.
  1. +3 −0  .hgignore
  2. +32 −0 README.rst
  3. +13 −0 setup.py
View
3  .hgignore
@@ -2,7 +2,10 @@ syntax:glob
.noseids
*.orig
*.pyc
+*.egg-info
bin
+build
+dist
share
lib
include
View
32 README.rst
@@ -28,6 +28,38 @@ Goals
Usage
=====
+-----
+Using
+-----
+
+1. ``python setup.py install`` # Or copy mmstats.py into your project
+2. ``import mmstats``
+3. Create a subclass of mmstats.MmStats like:
+
+::
+
+ class WebStats(mmstats.MmStats):
+ status2xx = mmstats.UIntStat(label='status.2XX')
+ status3xx = mmstats.UIntStat(label='status.3XX')
+ status4xx = mmstats.UIntStat(label='status.4XX')
+ status5xx = mmstats.UIntStat(label='status.5XX')
+
+4. Instantiate it once per thread/process:
+
+::
+
+ webstats = WebStats(label_prefix='web.stats.')
+
+5. Record some data:
+
+::
+
+ if response.status_code == 200:
+ webstats.status2xx += 1
+
+6. Run ``python slurpstats.py`` to read it
+7. Run ``python mmash.py`` to create a web interface for stats
+
-------------------
Testing/Development
-------------------
View
13 setup.py
@@ -0,0 +1,13 @@
+from setuptools import setup
+
+setup(
+ name='mmstats',
+ version='0.1',
+ license='BSD',
+ author='Michael Schurter',
+ author_email='m@schmichael.com',
+ description='Stat publishing and consuming tools',
+ py_modules=['mmstats', 'slurpmmstats', 'mmash', 'mmash_settings'],
+ install_requires=['Flask'],
+ classifiers=['License :: OSI Approved :: BSD License'],
+)
Please sign in to comment.
Something went wrong with that request. Please try again.