Git Product home page Git Product logo

statman_graphite's Introduction

Statman -> Graphite

This library pushes your metrics collected with statman to a graphite host over TCP.

For statman histograms only the percentiles are pushed as data points to graphite.

Using it

You need to set the host and port application variables before starting the app. After that you just need to record some metrics with statman.

application:set_env(statman_graphite, host, "graphite.example.com").
application:set_env(statman_graphite, port, 2003).
application:start(statman_graphite).
statman_aggregator:start_link().
record_some_statman_stats().

You can use the prefix application variable to set a global prefix that will be prepended to all metrics before they are send to graphite. This is useful in a multi-node scenario or when using something like hostedgraphite.com.

application:set_env(statman_graphite, prefix, <<"my-api-key">>).
application:set_env(statman_graphite, prefix, <<"my-api-key.", (list_to_binary(atom_to_list(node())))/binary>>).

Filtering/rewriting

There are two ways to filter what statman metrics are sent to graphite. By default all metrics are sent. The easy way to filter is to define the whitelist application variable, it should be a list of statman keys that you want to send to graphite.

application:set_env(statman_graphite, whitelist, [foo, {bar, baz}]).

If you want to do dynamic filtering and/or rewrite the metrics before sending them you can set the filtermapper application variable, it should be a fun that matches the docs for lists:filtermap. This option precedes the whitelist option.

application:set_env(statman_graphite, filtermapper, {mymodule, myfunction}).
%% Or as a fun
application:set_env(statman_graphite, filtermapper,
                    fun (Metric) ->
                         case proplists:get_value(key, Metric) of
                              foo ->
                                  false;
                              bar ->
                                  {true, lists:keystore(key, 1, Metric, {key, baz})};
                              baz ->
                                  true
                          end
                    end).

statman_graphite's People

Contributors

andonov avatar chrisavl avatar knutin avatar lastres avatar legoscia avatar wmalik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.