Lightning.PromEx (Lightning v2.15.0-pre5)
View SourceBe sure to add the following to finish setting up PromEx:
Update your configuration (config.exs, dev.exs, prod.exs, releases.exs, etc) to configure the necessary bit of PromEx. Be sure to check out
PromEx.Configfor more details regarding configuring PromEx:config :lightning, Lightning.PromEx, disabled: false, manual_metrics_start_delay: :no_delay, drop_metrics_groups: [], grafana: :disabled, metrics_server: :disabledAdd this module to your application supervision tree. It should be one of the first things that is started so that no Telemetry events are missed. For example, if PromEx is started after your Repo module, you will miss Ecto's init events and the dashboards will be missing some data points:
def start(_type, _args) do children = [ Lightning.PromEx, ... ] ... endUpdate your
endpoint.exfile to expose your metrics (or configure a standalone server using the:metrics_serverconfig options). Be sure to put this plug before yourPlug.Telemetryentry so that you can avoid having calls to your/metricsendpoint create their own metrics and logs which can pollute your logs/metrics given that Prometheus will scrape at a regular interval and that can get noisy:defmodule LightningWeb.Endpoint do use Phoenix.Endpoint, otp_app: :lightning ... plug PromEx.Plug, prom_ex_module: Lightning.PromEx ... endUpdate the list of plugins in the
plugins/0function return list to reflect your application's dependencies. Also update the list of dashboards that are to be uploaded to Grafana in thedashboards/0function.
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.