Giter Club home page Giter Club logo

exometer_prometheus's Introduction

Exometer Prometheus

This reporter is a building block for a Prometheus scrape endpoint based on Exometer metrics. An optional lightweight httpd endpoint is also included.

Build

$ ./rebar3 compile

Test

$ ./rebar3 eunit

Usage

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

{deps, [
    {exometer_prometheus, ".*", {git, "https://github.com/GalaxyGorilla/exometer_prometheus.git"}}
]}.

Then just configure it:

{exometer, [
   {report, [
       {reporters, [
           {exometer_report_prometheus, []}
       ]}
   ]}
]}

Subscribe a metric like this:

exometer_report:subscribe(exometer_report_prometheus, [my, metric, id], [value], manual, [{help, "some metric"}]).

If you know what you're doing you can also force the Prometheus type by adding e.g. {type, counter}. The mapping between Exometer and Prometheus metric types is explained below.

To fetch Prometheus metrics there is just one single API function:

exometer_report_prometheus:fetch().

This will simply deliver all subscribed metrics in Prometheus text format (as Erlang binary). You can deliver these metrics using your own webserver, usually on port 8081 and path /metrics. However, take care in using the correct content-type text/plain; version=0.0.4.

Built-in httpd Support

If you want to use the built-in httpd service enable and configure it like this (the shown option values are defaults):

{exometer_report_prometheus, [enable_httpd, {host, any}, {port, 8081}, {path, "/metrics"}]}

Exometer vs. Prometheus

Despite the naming of metric types Exometer and Prometheus really differ somewhat on what each metric is capable of. The largest pain point might be that Exometer histograms map on Prometheus summaries while Prometheus histograms have no real counterpart in Exometer. Also Exometer counters are not necessarily monotonely increasing while Prometheus counters rely on that. The following snippet will give you an overview how those types are mapped to each other. For precise examples just have a quick look into the tests, the snippet is generated by those.

# HELP some_counter some exometer counter
# TYPE some_counter gauge
some_counter 1

# HELP some_other_counter some other exometer counter with forced type
# TYPE some_other_counter counter
some_other_counter 1

# HELP some_gauge some exometer gauge
# TYPE some_gauge gauge
some_gauge 1.1235

# HELP some_spiral some exometer spiral
# TYPE some_spiral gauge
some_spiral 1

# HELP some_histogram some exometer histogram
# TYPE some_histogram summary
some_histogram{quantile="0.5"} 0
some_histogram{quantile="0.75"} 0
some_histogram{quantile="0.9"} 0
some_histogram{quantile="0.95"} 0
some_histogram{quantile="0.99"} 0
some_histogram{quantile="0.999"} 0
some_histogram_count 3
some_histogram_sum 0

# HELP some_function some exometer function
# TYPE some_function gauge
some_function{datapoint="port_count"} 6
some_function{datapoint="port_limit"} 65536

TODO

  • Add protocol buffer format
  • Proper support for Prometheus tags

exometer_prometheus's People

Contributors

galaxygorilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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