1 this observer needs BeanManager . This helper bean can be injected in any observer in an extension

2 retrieving @Metric annotation on the producer

3 treatment will be skip if no annotation found

4 retrieving name of the metric from the annotation

5 getting the initial producer to be able to use it in call back

6 we use the new ProducerConfigurator helpers. In CDI 1.2 we would have created our own implementation of Producer interface

7 we define a functional callback for producing the instance of the producer

8 retrieving the registry bean instance

9 looking for a metric with the matching name

10 if it doesn’t exist we create it by using the original producer code and it to the registry