GithubHelp home page GithubHelp logo

appmeter's Introduction

Appmeter allows Erlang applications to output metric information via handlers and provides a sampling mechanism to prevent metric collection/output from negatively impacting performance.

Usage

application:start(appmeter).
{ok, Pid} = appmeter:proxy().
appmeter_proxy:send_one(Pid, {measure, <<"foo">>, 1}).
appmeter_proxy:send_many(Pid, [{count, <<"bar">>, 3}, {gauge, <<"baz">>, 9}]).

Sampling

Sampling is done by a proxy process. Proxy processes are intended to be long lived processes that stand next to some application process producing metric data. For example, in Riak you might pair a proxy process with each vnode process.

Sampling is controlled by two parameters, flush_interval and max_sample_size. Between any two flushes a proxy process will buffer at most max_sample_size metrics. A count is maintained of all observed metrics in order to calculate a sample rate.

Flush Process

To avoid overwhelming any process message queues and to provide back pressure a seperate process per proxy is used to shuffle messages from the proxy to the event manager. This "flusher" process periodically drains sampled metrics from the proxy process and sends them along to the event manager. The flusher uses a synchronous call to the event manager to prevent overwhelming the event manager which is handling messages from many flusher processes.

The proxy process does not communicate directly with the event manager to avoid generating large message queues. If the proxy process communicated directly with the event manager using a synchronous call, the proxy process's message queue could be overwhelmed. If the proxy process used an asynchronous call to the event manager, the event manager's message queue could be overwhelmed.

Metrics

Three metric types are recognized count, gauge, and measure.

Handlers

StatsD is currently the only handler that has been implemented.

Supervision Tree

appmeter_sup (one_for_one)
  - appmeter_event_mgr_sup (one_for_one)
    - appmeter_event_mgr
  - appmeter_proxy_sup (simple_one_for_one)
    - appmeter_proxy

Proxy processes are supervised by a simple_one_for_one supervisor, however, the processes are configured as transient which means they will not be restarted. Additionally, sending data to a proxy process uses a gen_server:cast/2 which means that if the proxy process dies the send operation will fail silently. The proxy process should monitored and corrective action should be taken when necessary (e.g. start a new proxy process).

appmeter's People

Contributors

dreverri avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

chinnurtb

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.