Giter Club home page Giter Club logo

exometer_fetch's Introduction

exometer_fetch Build Status

This reporter acts as subscription handler such that other services (e.g. http server) can fetch metrics from it.

Usage

Add exometer_fetch to your list of dependencies in rebar.config:

{deps, [
    {exometer_fetch, ".*", {git, "https://github.com/travelping/exometer_fetch.git", "master"}}
]}.

Ensure exometer_fetch is started before your application:

{applications, [exometer_fetch]}.

Configure it:

{exometer,
    {reporters, [
        {exometer_report_fetch, [
            {autosubscribe, true},
            {subscriptions_module, exometer_fetch_subscribe_mod}
        ]}
    ]}
}.

It is possible to create a subscription automatically for each newly created metric entry. By default this is disabled. You can enable it in the reporter options. You must also provide a callback module which handles the entries. Apart from that there are no further options.

The callback module may look like:

-module(exometer_fetch_subscribe_mod).
-export([subscribe/2]).

subscribe([test, metric] = Metric, histogram) ->
    {Metric, [max, min], [{key, <<"some_key">>}]};
subscribe(_, _) -> [].

subscribe/2 calls for each new entry and it should return a (possibly empty) list or just one subscription. Here a single subscription has the following layout:

{exometer_report:metric(), exometer_report:datapoints(), exometer_report:extra()}

Subscription examples:

exometer_report:subscribe(exometer_report_fetch, [erlang, memory], total, manual, [{key, <<"some_key">>}]).

Check if everything is working:

exometer_fetch:fetch(<<"some_key">>).

Further it is possible to return only the value of a specific datapoint:

exometer_fetch:fetch(<<"some_key">>, total).

Keys always need to be given as binary. If a key is not found then all metrics which have this key as prefix will be returned (or an error if nothing is found).

About subscription time intervals:

The report interval in subscriptions should be set to manual such that the metric is actually never reported using time interval triggers. The metric value will be retrieved from exometer directly when one sends a request to the corresponding key.

exometer_fetch's People

Contributors

galaxygorilla avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.