Prometheus.ex - Prometheus.io Elixir integrations

Thank you! Excellent post. Just a note: prometheus_plugs can also instrument a single plug or it’s own pipeline:

defmodule EnsureAuthenticatedInstrumenter do
  use Prometheus.PlugInstrumenter

  plug Guardian.Plug.EnsureAuthenticated

  def label_value(:authenticated, {conn, _}) do
    conn.status != 401
  end
end

Basically it uses Plug.Builder and similar to it in this aspect.

1 Like