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.
View the StatsD installation instructions on github
To install this module: play install statsd
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
You need to configure the host and port that your StatsD/Graphite server is running on.
statsd.host
– specify the host of the statsd server. Defaults to localhost.
statsd.port
– specify the port of the statsd server. Defaults to 8125.
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.