No description
  • Elixir 98.3%
  • Shell 1.7%
Find a file
2020-10-07 10:21:30 -05:00
bin oh my logger 2018-09-01 10:10:18 +03:00
config first commit 2016-08-21 19:52:47 +03:00
lib Fix System.stacktrace/0 warning in Elixir 1.11 2020-10-07 10:13:45 -05:00
pages update to prometheus.erl 3.0.0 and sync tests/docs 2016-09-27 14:15:00 +03:00
test Inject default metrics into app env if prometheus application is not started. 2018-07-06 13:34:02 -05:00
.credo.exs make credo happy 2017-09-05 01:39:52 +03:00
.dir-locals.el use credo 2016-10-22 12:12:51 +03:00
.formatter.exs add elixir formatter config 2018-02-27 10:39:42 +03:00
.gitignore NEW: decorators - something works! 2017-09-04 05:35:11 +03:00
.travis.yml version matrix 2020-06-30 14:26:51 +02:00
coveralls.json enable coveralls 2016-09-03 17:57:07 +03:00
mix.exs Bump minimum compatible Elixir version 2020-10-07 10:21:30 -05:00
mix.lock bump deps 2019-01-24 10:36:12 +01:00
README.md fix link to monitoring article 2020-04-20 12:06:27 +03:00

Prometheus.ex

Build Status Hex.pm Coverage Status Hex.pm Documentation

Elixir Prometheus.io client based on Prometheus.erl.

Starting from v3.0.0 works with Elixir >=1.6 and Erlang >=20. For older verions, please use older tags.

@skosch dashboard

Dashboard from Monitoring Elixir apps in 2016: Prometheus and Grafana by @skosch.

  • IRC: #elixir-lang on Freenode;
  • Slack: #prometheus channel - Browser or App(slack://elixir-lang.slack.com/messages/prometheus).

Example

defmodule ExampleInstrumenter do
  use Prometheus.Metric

  def setup do    
    Histogram.new([name: :http_request_duration_milliseconds,
                   labels: [:method],
                   buckets: [100, 300, 500, 750, 1000],
                   help: "Http Request execution time"])
  end

  def instrument(%{time: time, method: method}) do
    Histogram.observe([name: :http_request_duration_milliseconds, labels: [method]], time)
  end
end

or

defmodule ExampleInstrumenter do
  use Prometheus.Metric

  @histogram [name: :http_request_duration_milliseconds,
              labels: [:method],
              buckets: [100, 300, 500, 750, 1000],
              help: "Http Request execution time"]

  def instrument(%{time: time, method: method}) do
    Histogram.observe([name: :http_request_duration_milliseconds, labels: [method]], time)
  end
end

Here histogram will be declared in auto-generated @on_load callback, i.e. you don't have to call setup manually.

Please read how to measure durations correctly with prometheus.ex.

Integrations / Collectors / Instrumenters

Dashboards

Installation

Available in Hex, the package can be installed as:

  1. Add prometheus_ex to your list of dependencies in mix.exs:

    def deps do
      [{:prometheus_ex, "~> 3.0"}]
    end
    
  2. Ensure prometheus_ex is started before your application:

    def application do
      [applications: [:prometheus_ex]]
    end