To expose the Prometheus metrics, we will use a set of Elixir libraries that let us emit new metrics and also introduce out-of-the-box Phoenix, Plug, and Ecto metrics:
$ cat apps/elixir_drip/mix.exs # ... defp deps do [ # ... {:prometheus, "~> 4.0", override: true}, {:prometheus_ex, "~> 3.0", override: true}, {:prometheus_ecto, "~> 1.0"}, ] end # ...$ cat apps/elixir_drip_web/mix.exs # ... defp deps do [ # ... {:prometheus_phoenix, "~> 1.2"}, {:prometheus_plugs, "~> 1.1"}, ] end # ...
Let's now start with the Phoenix metrics. We need to define a simple EndpointInstrumenter module, which will use the PhoenixInstrumenter module:
$ cat apps/elixir_drip_web/lib/elixir_drip_web/prometheus/endpoint_instrumenter.exdefmodule ...