To implement a custom metric, we will follow the same steps as we did previously: we will first configure our custom metric and then we will create a new Chronometer.defmeasured/2 macro that not only defines a new function, but also emits a histogram metric based on the function name and module.
This time, however, the module that exposes the setup/0 function will be more complex, since it needs to register the metrics and also expose the count/1, observe/2, and observe_duration/2 functions:
$ cat apps/elixir_drip/lib/elixir_drip/prometheus/instrumenter.exdefmodule ElixirDrip.Instrumenter do use Prometheus @histograms %{"storage_store" => "Time histogram for the Storage.store/ 4 function"} @counters %{"cache_worker_hit" ...