prometheus-erl/prometheus.ex

Prometheus.io Elixir client

Elixir

424

199 commits

updated Feb 10, 2026

See the code

README

Prometheus.ex

Hex.pm Hex.pm Hex Docs GitHub Actions Codecov

Elixir Prometheus.io client based on Prometheus.erl.

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

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, "~> 4.0"}]
    end
    
  2. Ensure prometheus_ex is started before your application:

    def application do
      [applications: [:prometheus_ex]]
    end
    
elixir
instrumentation
metrics
monitoring
prometheus

Contributors

deadtrickster

170 commits

NelsonVides

7 commits

feld

3 commits

hauleth

3 commits

prometheus-erl/prometheus.ex

Prometheus.io Elixir client

Elixir

424

199 commits

updated Feb 10, 2026

See the code

README

Prometheus.ex

Hex.pm Hex.pm Hex Docs GitHub Actions Codecov

Elixir Prometheus.io client based on Prometheus.erl.

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

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, "~> 4.0"}]
    end
    
  2. Ensure prometheus_ex is started before your application:

    def application do
      [applications: [:prometheus_ex]]
    end
    
elixir
instrumentation
metrics
monitoring
prometheus

Contributors

deadtrickster

170 commits

NelsonVides

7 commits

feld

3 commits

hauleth

3 commits

Languages

Elixir

100.0%