jrogov / prometheus-cowboy

Expose Prometheus metrics using cowboy/cowboy2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prometheus_cowboy

Copyright (c) 2017 Ilya Khaprov <i.khaprov@gmail.com>.

Version: 0.1.8

Hex.pm Hex.pm Downloads Build Status

Exporting metrics with handlers

Cowboy 1:

Routes = [
          {'_', [
                 {"/metrics/[:registry]", prometheus_cowboy1_handler, []},
                 {"/", toppage_handler, []}
                ]}
         ]

Cowboy 2:

Routes = [
          {'_', [
                 {"/metrics/[:registry]", prometheus_cowboy2_handler, []},
                 {"/", toppage_handler, []}
                ]}
         ]

Exporting Cowboy2 metrics

  {ok, _} = cowboy:start_clear(http, [{port, 0}],
                               #{env => #{dispatch => Dispatch},
                                 metrics_callback => fun prometheus_cowboy2_instrumenter:observe/1,
                                 stream_handlers => [cowboy_metrics_h, cowboy_stream_h]})

Contributing

Section order:

  • Types
  • Macros
  • Callbacks
  • Public API
  • Deprecations
  • Private Parts

Install the git pre-commit hook:

./bin/pre-commit.sh install

The pre-commit check can be skipped by passing --no-verify to git commit.

License

MIT

Modules

prometheus_cowboy
prometheus_cowboy1_handler
prometheus_cowboy2_handler
prometheus_cowboy2_instrumenter

About

Expose Prometheus metrics using cowboy/cowboy2

License:MIT License


Languages

Language:Erlang 91.0%Language:Shell 4.8%Language:Elixir 2.3%Language:Emacs Lisp 1.9%