prometheus-erl/prometheus.ex
Prometheus.io Elixir client
{ "createdAt": "2016-05-16T22:12:44Z", "defaultBranch": "master", "description": "Prometheus.io Elixir client", "fullName": "prometheus-erl/prometheus.ex", "homepage": "", "language": "Elixir", "name": "prometheus.ex", "pushedAt": "2025-08-06T15:39:07Z", "stargazersCount": 419, "topics": [ "elixir", "instrumentation", "metrics", "monitoring", "prometheus" ], "updatedAt": "2025-10-26T17:47:58Z", "url": "https://github.com/prometheus-erl/prometheus.ex"}Prometheus.ex
Section titled “Prometheus.ex”Elixir Prometheus.io client based on Prometheus.erl.
Dashboard from Monitoring Elixir apps in 2016: Prometheus and Grafana by @skosch.
Example
Section titled “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) endendor
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) endendHere 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
Section titled “Integrations / Collectors / Instrumenters”- Ecto collector
- Elli middleware
- Extatus - App to report metrics to Prometheus from Elixir GenServers
- Plugs Instrumenter/Exporter
- Fuse plugin
- OS process info Collector (Linux-only)
- Phoenix instrumenter
- RabbitMQ Exporter
Dashboards
Section titled “Dashboards”Installation
Section titled “Installation”Available in Hex, the package can be installed as:
-
Add
prometheus_exto your list of dependencies inmix.exs:def deps do[{:prometheus_ex, "~> 4.0"}]end -
Ensure
prometheus_exis started before your application:def application do[applications: [:prometheus_ex]]end