CDI Extension for eager registration of annotated application metrics
SmallRye Metrics provides a CDI extension which takes care of the annotation scanning and then registering
all detected metrics at deployment time. If your runtime supports CDI extensions, just make sure that
the io.smallrye.metrics.setup.MetricCdiInjectionExtension
extension is active. It is mandatory
to register metrics beforehand, because the metric interceptors expect metrics to already exist when
the interceptor is invoked (with the exception of Gauges, where registration is performed in a
@PostConstruct
method of the interceptor, that means when the owning bean is being instantiated).
If the target runtime does not support CDI extensions, a different strategy must be devised for scanning the deployment and registering annotated metrics.