From 9f79769030c2b7df8985b405a6e21ac5d6ada0eb Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Sep 2024 14:48:01 +0100 Subject: [PATCH] Start building against Micrometer 1.14.0 snapshots See gh-42137 --- .../cache/CacheMetricsAutoConfigurationTests.java | 6 ++++-- .../metrics/cache/CacheMetricsRegistrarTests.java | 14 +++++++++----- .../spring-boot-dependencies/build.gradle | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfigurationTests.java index 1d3894f07f..9cd4365df0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,9 @@ class CacheMetricsAutoConfigurationTests { @Test void autoConfiguredCacheManagerIsInstrumented() { - this.contextRunner.withPropertyValues("spring.cache.type=caffeine", "spring.cache.cache-names=cache1,cache2") + this.contextRunner + .withPropertyValues("spring.cache.type=caffeine", "spring.cache.cache-names=cache1,cache2", + "spring.cache.caffeine.spec=recordStats") .run((context) -> { MeterRegistry registry = context.getBean(MeterRegistry.class); registry.get("cache.gets").tags("name", "cache1").tags("cache.manager", "cacheManager").meter(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrarTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrarTests.java index 8b6dbc783a..e0894f539d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrarTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrarTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,9 @@ class CacheMetricsRegistrarTests { void bindToSupportedCache() { CacheMetricsRegistrar registrar = new CacheMetricsRegistrar(this.meterRegistry, Collections.singleton(new CaffeineCacheMeterBinderProvider())); - assertThat(registrar.bindCacheToRegistry(new CaffeineCache("test", Caffeine.newBuilder().build()))).isTrue(); + assertThat( + registrar.bindCacheToRegistry(new CaffeineCache("test", Caffeine.newBuilder().recordStats().build()))) + .isTrue(); assertThat(this.meterRegistry.get("cache.gets").tags("name", "test").meter()).isNotNull(); } @@ -49,8 +51,8 @@ class CacheMetricsRegistrarTests { void bindToSupportedCacheWrappedInTransactionProxy() { CacheMetricsRegistrar registrar = new CacheMetricsRegistrar(this.meterRegistry, Collections.singleton(new CaffeineCacheMeterBinderProvider())); - assertThat(registrar.bindCacheToRegistry( - new TransactionAwareCacheDecorator(new CaffeineCache("test", Caffeine.newBuilder().build())))) + assertThat(registrar.bindCacheToRegistry(new TransactionAwareCacheDecorator( + new CaffeineCache("test", Caffeine.newBuilder().recordStats().build())))) .isTrue(); assertThat(this.meterRegistry.get("cache.gets").tags("name", "test").meter()).isNotNull(); } @@ -58,7 +60,9 @@ class CacheMetricsRegistrarTests { @Test void bindToUnsupportedCache() { CacheMetricsRegistrar registrar = new CacheMetricsRegistrar(this.meterRegistry, Collections.emptyList()); - assertThat(registrar.bindCacheToRegistry(new CaffeineCache("test", Caffeine.newBuilder().build()))).isFalse(); + assertThat( + registrar.bindCacheToRegistry(new CaffeineCache("test", Caffeine.newBuilder().recordStats().build()))) + .isFalse(); assertThat(this.meterRegistry.find("cache.gets").tags("name", "test").meter()).isNull(); } diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 3a9b685a54..a7dfc0fdd9 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1301,7 +1301,7 @@ bom { ] } } - library("Micrometer", "1.14.0-M2") { + library("Micrometer", "1.14.0-SNAPSHOT") { considerSnapshots() group("io.micrometer") { modules = [