Skip to content

Latest commit

 

History

History
41 lines (33 loc) · 1.51 KB

README.md

File metadata and controls

41 lines (33 loc) · 1.51 KB

prometheus_cowboy

Hex.pm Hex.pm Hex Docs GitHub Actions Codecov

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]})