View Source PromEx.Plugins.PhoenixLiveView (PromEx v1.10.0)

This plugin captures metrics emitted by PhoenixLiveView. Specifically, it captures events related to the mount, handle_event, and handle_params callbacks for live views and live components.

This plugin supports the following options:

  • metric_prefix: This option is OPTIONAL and is used to override the default metric prefix of [otp_app, :prom_ex, :phoenix_live_view]. If this changes you will also want to set phoenix_live_view_metric_prefix in your dashboard_assigns to the snakecase version of your prefix, the default phoenix_live_view_metric_prefix is {otp_app}_prom_ex_phoenix_live_view.

  • duration_unit: This is an OPTIONAL option and is a Telemetry.Metrics.time_unit(). It can be one of: :second | :millisecond | :microsecond | :nanosecond. It is :millisecond by default.

This plugin exposes the following metric groups:

  • :phoenix_live_view_event_metrics
  • :phoenix_live_view_component_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.PhoenixLiveView
    ]
  end

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