Skip to main content

A simple, configurable statsd client for Flask apps with optional Datadog support.

Project description

It also provides optional support for Dogstatsd with the [Datadog] optional install.

Home-page: Author: Brad Belyeu Author-email: License: MIT Download-URL: Description: # Flask-StatsClient

[![Build Status](]( [![Coverage Status](](

## Requirements

This project requires Python 3.5+ and Flask 0.12. Test builds in Travis CI test 3.5 & 3.6.

## Installation

To install it, simply run

pip install flask-statsdclient

If you’re using Datadog( for your metric collection, you can enable the additional functionality of dogstatsd( by installing it via

pip install flask-statsdclient[Datadog]

## Usage

Import it and wrap app

from flask import Flask from flask_statsdclient import StatsDClient

app = Flask(__name__) statsd = StatsDClient(app)

You may modify the host, port and prefix with STATSD_HOST, STATSD_PORT and STATSD_PREFIX options respectively in your Flask app config.

If you are using Datadog with a Unix socket, instead of specifying the host & port in config, add DD_SOCKET which is a fully qualified Unix path to the socket.

## Development

On a mac you can use the following commands to get up and running. ` bash brew install python3 ` otherwise run ` bash brew upgrade python3 ` to make sure you have an up to date version.

This project uses [pip-tools]( for dependency management. Install pip-tools

` bash pip3 install pip-tools `

setup the project env ` base python -m venv venv pip install -r requirements.txt -r requirements-dev.txt `

Make sure the following environment variables are set ` bash export PYTHONPATH=`pwd` `

Then load your virtualenv `bash source venv/bin/activate `

### Running tests

` bash ./ && coverage run --source=flask_statsdclient/ test `

### Before committing any code

We have a pre-commit hook each dev needs to setup. You can symlink it to run before each commit by changing directory to the repo and running

` bash cd .git/hooks ln -s ../../pre-commit pre-commit `

Keywords: flask,statsd,metrics,instrumentation Platform: any Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: >=3.5 Provides-Extra: Datadog

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Flask-StatsDClient, version 2.1.0
Filename, size File type Python version Upload date Hashes
Filename, size Flask-StatsDClient-2.1.0.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page