Skip to content

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

License

Notifications You must be signed in to change notification settings

nitzanharel/estatsd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published