Class GaugeAnnotationHandler
- java.lang.Object
-
- io.quarkus.micrometer.deployment.binder.mpmetrics.GaugeAnnotationHandler
-
public class GaugeAnnotationHandler extends Object
Create beans to handle@Gaugeannotations. This is a static utility class, it stores no state. It is ok to import and use classes that reference MP Metrics classes.
-
-
Constructor Summary
Constructors Constructor Description GaugeAnnotationHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static voidcreateClass(org.jboss.jandex.IndexView index, io.quarkus.gizmo.ClassOutput classOutput, String generatedClassName, org.jboss.jandex.AnnotationInstance annotation, org.jboss.jandex.AnnotationTarget target, org.jboss.jandex.ClassInfo classInfo, org.jboss.jandex.MethodInfo methodInfo)Given this Widget class:(package private) static voidprocessAnnotatedGauges(org.jboss.jandex.IndexView index, io.quarkus.gizmo.ClassOutput classOutput)
-
-
-
Method Detail
-
processAnnotatedGauges
static void processAnnotatedGauges(org.jboss.jandex.IndexView index, io.quarkus.gizmo.ClassOutput classOutput)
-
createClass
static void createClass(org.jboss.jandex.IndexView index, io.quarkus.gizmo.ClassOutput classOutput, String generatedClassName, org.jboss.jandex.AnnotationInstance annotation, org.jboss.jandex.AnnotationTarget target, org.jboss.jandex.ClassInfo classInfo, org.jboss.jandex.MethodInfo methodInfo)Given this Widget class:public class Widget { private LongAccumulator highestValue = new LongAccumulator(Long::max, 0); // ... some other things that change the value in the accumulator ... @Gauge(name = "highestValue", unit = MetricUnits.NONE, description = "Highest observed value.") public Long highestValue() { return highestValue.get(); } }This method will generate a GaugeAdapter to call the annotated method:
public class Widget_GaugeAdapter extends GaugeAdapter.GaugeAdapterImpl implements GaugeAdapter { @Inject Widget target; public Widget_GaugeAdapter() { // name, description, and tags are created from annotation attributes // init is a method on the superclass super(name, description, tags); } Number getValue() { return target.highestValue; } Object getValue() { return getValue(); } }
-
-