Hi,

I'm using spring-boot 3.3.0 (spring-framework 6.1.8). After migration from spring-boot 3.2.5, the metrics are false because the timer for RestClient counts twice the calls (http.client.request).

This can be reproduced with a simple spring boot test:

@Test
void restClientMetricsBug() {
   // registry and clientBuilder are injected 
   clientBuilder.baseUrl("http://localhost:8080").build().get().retrieve().toEntity(String.class);
   var tm = registry.get("http.client.requests").timer();
   assertEquals(1, tm.count());  // fails with 1 != 2
}

The problem seems to be (to my opinion) that Timer.stop is called twice: - the first time on DefaultRestClient L230 because clientResponse is AutoClosable (close stops the observation), - the second time in finally on L254 (observation.stop is called a second time) (observation.stop() calls indirectly Timer$Sample.stop()).

I hope my analysis will be helpfull.

Thanks.

Comment From: bclozel

Thanks for your report @MilanSMA , this is now fixed in 6.1.10-SNAPSHOT and will be released later today.