View Source PromEx.Plugins.Ecto (PromEx v1.9.0)

This plugin captures metrics emitted by Ecto. Be sure that your PromEx module is listed before your Repo module in your supervision tree so that the Ecto init events are not missed. If you miss those events the dashboard variable dropdowns for the repo value will be broken.

This plugin supports the following options:

  • otp_app: This is an OPTIONAL option and is the name of you application in snake case (e.g. :my_cool_app). By default the otp_app set for the prom_ex module that this plugin is defined in is used.

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

  • repos: This is an OPTIONAL option and is a list with the full module name of your Ecto Repos (e.g [MyApp.Repo]). If you do not provide this value, PromEx will attempt to resolve your Repo modules via the :ecto_repos configuration on your OTP app.

  • 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:

  • :ecto_init_event_metrics
  • :ecto_query_event_metrics

To use plugin in your application, add the following to your PromEx module plugins/0 function:

def plugins do
  [
    ...

    {PromEx.Plugins.Ecto, otp_app: :web_app, repos: [WebApp.Repo]}
  ]
end