Skip to content
A play plugin for easy integration with statsd
Java Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
conf
dist
documentation/manual
lib
src
README.textile
build.xml
commands.py
commands.pyc

README.textile

play-statsd – StatsD plugin for the Play Framework

StatsD

A network daemon for aggregating statistics (counters and timers), rolling them up, then sending them to graphite for graphing. This module provides an embedded client which will send counter and timer statistics to StatsD via UDP. For more information on StatsD view the great post from Etsy on what it is and how its used.

This plugin requres a pre-configured StatsD server to send events to. Since it uses UDP, the application will continue to function normally in the event of a StatsD server outage, all statistics sent during this time will be lost. UDP is unreliable so you should be aware that in the event of network congestion, some packets can be lost.

Installation

View the StatsD installation instructions on github

To install this module: play install statsd

Enable the module

After installing the module, add the following to your conf/dependencies.yml to enable it (don’t forget to run play dependencies)

require: - play -> play-statsd 0.1

Configure the module

You need to configure the host and port that your StatsD/Graphite server is running on.

Host

statsd.host – specify the host of the statsd server. Defaults to localhost.

Port

statsd.port – specify the port of the statsd server. Defaults to 8125.

Usage

Statsd provides methods to emit statistics via increment, decrement, and timer methods. Each method takes a value which represents the “bucket” in Graphite that the statistic should reside in. As an example, suppose you have an application which supports user login, and you would like to track how often users log in, and how many times users fail to log in successfully.

By adding Statsd.increment("my_application.user_logins"); to the controler method upon successful user login, StatsD would increment the “my_application.user_login” bucket by one. In a similar fashion you would add Statsd.increment("my_application.user_login_failures"); to increase the failed counts.

Something went wrong with that request. Please try again.