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

This plugin captures metrics regarding your application, and its dependencies. Specifically, it captures the versions of your application and the application dependencies and also how many modules each dependency is bringing into the project.

This plugin supports the following options:

  • otp_app: This is a REQUIRED option and is the name of you application in snake case (e.g. :my_cool_app).

  • deps: This option is OPTIONAL and defines what dependencies the plugin should track. A value of :all means that PromEx will fetch details on all application dependencies. A list of dependency names like [:phoenix, :ecto, :unplug] means that PromEx will only fetch details regarding those dependencies.

  • git_sha_mfa: This option is OPTIONAL and defines an MFA that will be called in order to fetch the application's Git SHA at the time of deployment. By default, an Application Plugin function will be called and will attempt to read the GIT_SHA environment variable to populate the value.

  • git_author_mfa: This option is OPTIONAL and defines an MFA that will be called in order to fetch the application's last Git commit author at the time of deployment. By default, an Application Plugin function will be called and will attempt to read the GIT_AUTHOR environment variable to populate the value.

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

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

  • :application_versions_manual_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.Application, [otp_app: :my_cool_app]},
        ...
      ],
      delay_manual_start: :no_delay
    }
  ]

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

This plugin exposes manual metrics so be sure to configure the PromEx :delay_manual_start as required.