(Abandoned) Batched Erlang StatsD Client
Erlang Shell
Switch branches/tags
Nothing to show
Latest commit ae35c75 Jun 14, 2013 Johannes Huning Johannes Huning Send messages using the pid. Fixes #1



BESC is a StatsD client for Erlang.

Counter increments and timings are collected first and get dispatched every 2500 metrics or on timeout.


Add besc to your project of choice via rebar:

% rebar.config
{deps, [
    % Batched Erlang StatsD Client.
    {besc, "",
        {git, "git@github.com:wooga/besc.git",
        {branch, "stable"}}}

The default configuration points to a StatsD server at listening on port 3344, this can be changed however:

  • Override the configuration using application:set_env and friends:

    application:set_env(besc, host, ""),
    application:set_env(besc, port, 1259),
  • When building your own supervision tree:

    besc:start_link(Hostname, PortNum)
  • Or the custom start entirely:

    besc:start(Hostname, PortNum).


Find an overview of the concept of timings and counters on the Flickr Blog.

  1. besc:inc(Key, By, Rate) increments a counter, where the fields are:
  • Key - A key describing what is being counted, interpreted as a string
  • By - The amount by which to increment the counter
  • Rate - The sampling rate
  1. besc:dec(Key, By, Rate) the opposite of inc, decrements a counter. Parameters are the same as with inc
  2. besc:time(Key, Value, Rate) measure how long a task took. Parameters are the same, except for By, which is labeled Value and reflects the task's duration in miliseconds


1> application:start(besc).
2> {Duration, _} = timer:tc(timer, sleep, [random:uniform(100)]).
3> besc:time("sleep_duration", Duration, 0.75).
4> besc:inc("noops", 1, 1.0).

Received and subsequently interpreted on the server's side:



This project is licensed under the FreeBSD License. A copy of the license can be found in the repository.