PromEx.Plugins.Phoenix (PromEx v1.1.1) View Source

This plugin captures metrics emitted by Phoenix. Specifically, it captures HTTP request metrics and Phoenix channel metrics.

This plugin supports the following options:

  • router: This is a REQUIRED option and is the full module name of your Phoenix Router (e.g MyAppWeb.Router).

  • event_prefix: This option is OPTIONAL and allows you to set the event prefix for the Telemetry events. This value should align with what you pass to Plug.Telemetry in your endpoint.ex file (see the plug docs for more information https://hexdocs.pm/plug/Plug.Telemetry.html)

This plugin exposes the following metric groups:

  • :phoenix_http_event_metrics
  • :phoenix_channel_event_metrics

To use plugin in your application, add the following to your PromEx module:

defmodule WebApp.PromEx do
  use PromEx, otp_app: :web_app

  @impl true
  def plugins do
    [
      ...
      {PromEx.Plugins.Phoenix, router: WebAppWeb.Router}
    ]
  end

  @impl true
  def dashboards do
    [
      ...
      {:prom_ex, "phoenix.json"}
    ]
  end
end