PromEx.Plugins.Phoenix (PromEx v0.1.6-alpha) 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 application supervision tree:

def start(_type, _args) do
  children = [
    ...
    {
      PromEx,
      plugins: [
        {PromEx.Plugins.Phoenix, router: MyAppWeb.Router},
        ...
      ]
    }
  ]

  opts = [strategy: :one_for_one, name: MyApp.Supervisor]
  Supervisor.start_link(children, opts)
end