1
votes

I am trying to use the metrics microprofile in wildfly 18.0.1. I would like to use the @Timed annotation in some of my methods, to see how long they take. But this metrics are always zero. My methods are like this:

 @Timed(unit = MetricUnits.SECONDS)
 public void pushNextElement(XMLStreamReader reader, Emitter<Object> emitter)
        throws XMLStreamException, JAXBException {
     //some logic here

 }

I can view all the metrics in the browser using the http://localhost:9990/metrics url. I can see that all the metrics that are wildfly metrics have values other than zero.

Is there anything else I should do so I can see some values? The methods that are annotated take at least some seconds to execute, so it cannot be the case that they are so fast, that zero is shown.