LiveDashboardHistory v0.1.0-alpha.4 Phoenix.LiveDashboard.Router View Source
Provides LiveView routing for LiveDashboard.
Link to this section Summary
Functions
Defines a LiveDashboard route.
Link to this section Functions
Defines a LiveDashboard route.
It expects the path
the dashboard will be mounted at
and a set of options.
Options
:metrics
- Configures the module to retrieve metrics from. It can be amodule
or a{module, function}
. If nothing is given, the metrics functionality will be disabled.:env_keys
- Configures environment variables to display. It is defined as a list of string keys. If not set, the environment information will not be displayed.:live_socket_path
- Configures the socket path. it must match thesocket "/live", Phoenix.LiveView.Socket
in your endpoint.:metrics_history
- Configures a callback for retreiving metric history. It must be an "MFA" tuple of{Module, :function, arguments}
such as metrics_history: {MyStorage, :metrics_history, []} If not set, metrics will start out empty/blank and only display data that occurs while the browser page is open.
Examples
defmodule MyAppWeb.Router do
use Phoenix.Router
import Phoenix.LiveDashboard.Router
scope "/", MyAppWeb do
pipe_through [:browser]
live_dashboard "/dashboard",
metrics: {MyAppWeb.Telemetry, :metrics},
env_keys: ["APP_USER", "VERSION"],
metrics_history: {MyStorage, :metrics_history, []}
end
end