Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.02 KB

metricsAnnotations.adoc

File metadata and controls

28 lines (20 loc) · 1.02 KB

You can use the Micrometer @Timed and @Counted annotations on any bean method by adding the micronaut-micrometer-annotation dependency to your annotation processor classpath:

dependency:micronaut-micrometer-annotation[groupId="io.micronaut.micrometer", scope="annotationProcessor"]

In order to support adding additional tags programmatically similar to Micrometer’s TimedAspect / CountedAspect ability using a ProceedingJoinPoint, create beans of type AbstractMethodTagger

MetricsTagger example
link:{testsmetricscore}/MethodNameTagger.java[role=include]

You can filter these taggers by utilizing the MetricOptions annotation

MetricOptions filtering taggers example
link:{testmetricscore}/MetricOptionsFilterTaggersExample.java[role=include]

The MetricOptions annotation also provides a means of only processing / publishing a metric based on an EvaluatedExpression

MetricOptions condition example
link:{testmetricscore}/MetricOptionsConditionExample.java[role=include]