diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/redis/LettuceMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/redis/LettuceMetricsAutoConfiguration.java index c51a7a294d..3b7bc7a802 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/redis/LettuceMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/redis/LettuceMetricsAutoConfiguration.java @@ -47,7 +47,7 @@ public class LettuceMetricsAutoConfiguration { @Bean @ConditionalOnMissingBean MicrometerOptions micrometerOptions() { - return MicrometerOptions.builder().histogram(true).build(); + return MicrometerOptions.create(); } @Bean diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/redis/LettuceMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/redis/LettuceMetricsAutoConfigurationTests.java index df06304e69..8578701624 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/redis/LettuceMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/redis/LettuceMetricsAutoConfigurationTests.java @@ -52,6 +52,20 @@ class LettuceMetricsAutoConfigurationTests { }); } + @Test + void autoConfiguredMicrometerOptionsUsesLettucesDefaults() { + this.contextRunner.with(MetricsRun.simple()) + .withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)).run((context) -> { + MicrometerOptions micrometerOptions = context.getBean(MicrometerOptions.class); + assertThat(micrometerOptions.isEnabled()).isEqualTo(MicrometerOptions.DEFAULT_ENABLED); + assertThat(micrometerOptions.isHistogram()).isEqualTo(MicrometerOptions.DEFAULT_HISTOGRAM); + assertThat(micrometerOptions.localDistinction()) + .isEqualTo(MicrometerOptions.DEFAULT_LOCAL_DISTINCTION); + assertThat(micrometerOptions.maxLatency()).isEqualTo(MicrometerOptions.DEFAULT_MAX_LATENCY); + assertThat(micrometerOptions.minLatency()).isEqualTo(MicrometerOptions.DEFAULT_MIN_LATENCY); + }); + } + @Test void whenUserDefinesAMicrometerOptionsBeanThenCommandLatencyRecorderUsesIt() { this.contextRunner.with(MetricsRun.simple())