prometheus_plugs v1.0.0-alpha1 Prometheus.PlugExporter

Exports Prometheus metrics via configurable endpoint:

# define plug
defmodule MetricsPlugExporter do
  use Prometheus.PlugExporter
end

# on app startup (e.g. supervisor setup)
MetricsPlugExporter.setup()

# in your plugs pipeline
plug MetricsPlugExporter

Metrics

Also maintains telemetry metrics:

  • telemetry_scrape_duration_seconds
  • telemetry_scrape_size_bytes

Do not forget to call setup/0 before using plug, for example on application start!

Configuration

Plugs exporter can be configured via PlugsExporter key of prometheus app env.

Default configuration:


config :prometheus, MetricsPlugExporter, # (you should replace this with the name of your plug)
  path: "/metrics",
  format: :text,
  registry: :default

Bear in mind that bounds are microseconds (1s is 1_000_000us)