diff --git a/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/metrics/EurekaInstanceMonitor.java b/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/metrics/EurekaInstanceMonitor.java index 2b35b8d33..50d2ff98f 100644 --- a/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/metrics/EurekaInstanceMonitor.java +++ b/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/metrics/EurekaInstanceMonitor.java @@ -79,10 +79,10 @@ public class EurekaInstanceMonitor implements SmartApplicationListener { private Map collectAggregatedCounts() { return instanceRegistry.getApplications() - .getRegisteredApplications() - .stream() - .flatMap(application -> application.getInstances().stream()) - .collect(Collectors.groupingBy(tagProvider::eurekaInstanceTags, Collectors.counting())); + .getRegisteredApplications() + .stream() + .flatMap(application -> application.getInstances().stream()) + .collect(Collectors.groupingBy(tagProvider::eurekaInstanceTags, Collectors.counting())); } private void registerMetrics(Map aggregatedCounts) { diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java index b85cb7993..d86e7a271 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java @@ -48,8 +48,8 @@ import static org.springframework.cloud.netflix.eureka.server.EurekaInstanceFixt */ @SpringBootTest(classes = EurekaInstanceMonitorWithCustomTagsProviderTests.Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - value = {"spring.application.name=eureka", "eureka.server.metrics.enabled=true", - "eureka.client.register-with-eureka=false", "eureka.client.fetch-registry=false"}) + value = { "spring.application.name=eureka", "eureka.server.metrics.enabled=true", + "eureka.client.register-with-eureka=false", "eureka.client.fetch-registry=false" }) class EurekaInstanceMonitorWithCustomTagsProviderTests { private static final String APP_NAME = "FOO-APP-NAME"; @@ -92,17 +92,17 @@ class EurekaInstanceMonitorWithCustomTagsProviderTests { private void assertEurekaInstance(Map meterRegistryCounts) { await().atMost(5, SECONDS) - .pollInterval(fibonacci()) - .untilAsserted(() -> meterRegistryCounts.forEach((tags, - count) -> { - SoftAssertions softAssertions = new SoftAssertions(); - softAssertions.assertThat((long) meterRegistry.get("eureka.server.instances") - .tags(tags).gauge().value()).isNotNull(); - softAssertions.assertThat((long) meterRegistry.get("eureka.server.instances") - .tags(tags).gauge().value()) - .isEqualTo(count); - softAssertions.assertAll(); - })); + .pollInterval(fibonacci()) + .untilAsserted(() -> meterRegistryCounts.forEach((tags, count) -> { + SoftAssertions softAssertions = new SoftAssertions(); + softAssertions + .assertThat((long) meterRegistry.get("eureka.server.instances").tags(tags).gauge().value()) + .isNotNull(); + softAssertions + .assertThat((long) meterRegistry.get("eureka.server.instances").tags(tags).gauge().value()) + .isEqualTo(count); + softAssertions.assertAll(); + })); } @Configuration(proxyBeanMethods = false)