Class GaugeAnnotationHandler
java.lang.Object
io.quarkus.micrometer.deployment.binder.mpmetrics.GaugeAnnotationHandler
Create beans to handle
@Gauge annotations.
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 -
Method Summary
Modifier and TypeMethodDescription(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)
-
Constructor Details
-
GaugeAnnotationHandler
public GaugeAnnotationHandler()
-
-
Method Details
-
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(); } }
-