Align auto-configured Lettuce metrics with Lettuce's defaults

Closes gh-32986
pull/32994/head
Andy Wilkinson 2 years ago
parent 8e08931411
commit 604aa4d512

@ -47,7 +47,7 @@ public class LettuceMetricsAutoConfiguration {
@Bean
@ConditionalOnMissingBean
MicrometerOptions micrometerOptions() {
return MicrometerOptions.builder().histogram(true).build();
return MicrometerOptions.create();
}
@Bean

@ -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())

Loading…
Cancel
Save