Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Erlang stats aggregation app that periodically flushes data to a graphing system of your choice, e.g. Graphite or Librato Metrics
branch: master

This branch is 17 commits ahead of wooga:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
apps/estatsd/src
rel
.gitignore
LICENSE
Makefile
README.markdown
rebar
rebar.config

README.markdown

estatsd

Heavily modified fork of the Opscode estatsd, able to publish metrics to Librato and StatHat.

Adding estatsd as a dependency

Even though estatsd comes as a node you can add it as a dependency:

  1. Clone or submodule estatsd into your priv/ directory or whatever have you
  2. Include it in sub_dirs in your rebar.config, e.g.:

     {sub_dirs, [
       "apps/my_app",
       "priv/estatsd/apps/estatsd",
       "rel"
     ]}.
  3. Add an include_cond to your reltool.config:

     % ...
     {app, my_app, [{incl_cond, include}]},
     {app, estatsd, [{incl_cond, include}]}
     % ...
  4. Make sure you have a estatsd section, like the one in rel/files/app.config, in your environment.

Should you know a better way, let me know!

Installation & Usage

I recommend you run estatsd as a standalone node to which you talk from your various clients. Otherwise, include estatsd into your project, then make sure you start the application, e.g.:

application:start(estatsd).

See rel/files/app.config for a list of configuration options and their descriptions.

Counters

% Increment `num_foos` by one:
estatsd:increment(num_foos).

% Decrement `num_bars` by 3:
estatsd:decrement(<<"num_bars">>, 3).

% Increment `tcp.bytes_in` by 512:
estatsd:increment("tcp.bytes_in", 512).

Timers

% Report that `sometask` took 1534ms:
estatsd:timing(sometask, 1534).

Sampling

% Let estatsd know that only 10% are being reported.
% 125 * (1/0.1) = value actually incremented by.
estatsd:increment(num_foos, 125, 0.1).

Metrics Groups & Librato

Librato does not (yet) support combining several different metrics into one chart.

This has been implemented! :)

To achieve this effect the Librato Adapter introduces the notion of groups:

estatsd:increment("myapp.calls-failure").
estatsd:increment("myapp.calls-success").
estatsd:increment("myapp.calls-unknown").

As a result you get one metric named myapp.calls including three different graphs, namely failure, success and unknown.

Something went wrong with that request. Please try again.