Prometheus.ex v3.0.5 Prometheus.Config View Source
Configuration templates for custom collectors/exporters.
When use
ed, generates accessor for each configuration option:
iex(4)> defmodule MyInstrumenter do
...(4)> use Prometheus.Config, [:required_option,
...(4)> registry: :default]
...(4)> end
iex(5)> MyInstrumenter.Config.registry(MyInstrumenter)
:default
iex(6)> MyInstrumenter.Config.required_option!(MyInstrumenter)
** (Prometheus.Config.KeyNotFoundError) mandatory option :required_option not found in PrometheusTest.MyInstrumenter instrumenter/collector config
iex(7)> Application.put_env(:prometheus, MyInstrumenter,
...(7)> [required_option: "Hello world!"])
:ok
iex(8)> MyInstrumenter.Config.required_option!(MyInstrumenter)
"Hello world!"