Migrating Timer to Observation API in the Spring Boot 3

99 Views Asked by At

As of Spring Boot 3, the Micrometer timer is needed to migrate to the new Observation API as stated in the documentation.

However, there is only an example for Timer.sample and I need to know about Timer.record(timeElapsed).

I have a method called getTimer:

Timer getTimer(string a){
 return meterRegistry.timer("module",
                    "runtime", a); //tags
}
Timer timedd =  getTimer(a);
timedd.record(timeElapsed)

Any idea about how to use Migrating Timer to Observation API?

0

There are 0 best solutions below