Flask extension for dogstatsd-python-fixed
Compatible with Python 2.7, 3.3 and pypy
pip install flask-dogstatsd
pip install -r requirements.txt
pip install -r tests/requirements.txt
./setup.py develop
./setup.py test
# app.py
from flask import Flask
from flask.ext.dogstatsd import DogStatsd
app = Flask(__name__)
app.config['DOGSTATSD_HOST'] = 'localhost' # This is the default
app.config['DOGSTATSD_PORT'] = 8125 # This is the default
app.config['DOGSTATSD_PREFIX'] = 'app' # False-y values disable prefixing
dogstatsd = DogStatsd(app)
@app.route('/'):
def index():
# See dogstatsd-python for the full API.
# Methods are forwarded to that.
# Since our prefix is 'app', the full key will be 'app.index.views'
dogstatsd.increment('index.views')
return 'Home'