Skip to content

prometheus-erl/prometheus.ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus.ex

Build Status Hex.pm Coverage Status Hex.pm Documentation

Elixir Prometheus.io client based on Prometheus.erl.

@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

Integrations / Collectors / Instrumenters

Installation

Available in Hex, the package can be installed as:

  1. Add prometheus_ex to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:prometheus_ex, "~> 1.0.0"}]
end
```
  1. Ensure prometheus_ex is started before your application:
```elixir
def application do
  [applications: [:prometheus_ex]]
end
```