metrics icon indicating copy to clipboard operation
metrics copied to clipboard

ScheduledReporter reports metrics when stopped/closed even when not started

Open ummels opened this issue 1 year ago • 2 comments
trafficstars

ScheduledReporter's close method calls its stop method, which calls report to report the metrics "one last time". This also happens if start has never been called.

In a SpringBoot application that registers a ScheduledReporter as a bean, this can lead to strange behavior since the stop method is automatically called by Spring Boot.

ummels avatar Apr 26 '24 10:04 ummels

My assumption is the logic was indeed "one last time" or metrics would be lost. What's wrong with this? I suspect you could subclass and override close. And track with AtomicBoolean.compareAndSet

mikebell90 avatar Jun 12 '24 18:06 mikebell90

I've opened #4246 for this issue. I've just added a check whether the reporter has been started.

ummels avatar Jun 16 '24 09:06 ummels