Commit 182b75a1 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #26135 from izeye

* pr/26135:
  Polish

Closes gh-26135
parents 641df02b e27c8569
...@@ -86,7 +86,7 @@ dependencies { ...@@ -86,7 +86,7 @@ dependencies {
optional("org.mongodb:mongodb-driver-reactivestreams") optional("org.mongodb:mongodb-driver-reactivestreams")
optional("org.mongodb:mongodb-driver-sync") optional("org.mongodb:mongodb-driver-sync")
optional("org.neo4j.driver:neo4j-java-driver") optional("org.neo4j.driver:neo4j-java-driver")
optional("org.quartz-scheduler:quartz") optional("org.quartz-scheduler:quartz")
optional("org.springframework:spring-jdbc") optional("org.springframework:spring-jdbc")
optional("org.springframework:spring-jms") optional("org.springframework:spring-jms")
optional("org.springframework:spring-messaging") optional("org.springframework:spring-messaging")
......
...@@ -93,7 +93,7 @@ public class MongoMetricsAutoConfiguration { ...@@ -93,7 +93,7 @@ public class MongoMetricsAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
MongoConnectionPoolTagsProvider mongoMetricsConnectionPoolTagsProvider() { MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider() {
return new DefaultMongoConnectionPoolTagsProvider(); return new DefaultMongoConnectionPoolTagsProvider();
} }
......
...@@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
public class RepositoryMetricsAutoConfigurationIntegrationTests { class RepositoryMetricsAutoConfigurationIntegrationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().with(MetricsRun.simple()) private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().with(MetricsRun.simple())
.withConfiguration( .withConfiguration(
......
...@@ -28,7 +28,6 @@ import io.micrometer.core.instrument.distribution.HistogramSnapshot; ...@@ -28,7 +28,6 @@ import io.micrometer.core.instrument.distribution.HistogramSnapshot;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun; import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
import org.springframework.boot.actuate.autoconfigure.metrics.web.TestController;
import org.springframework.boot.actuate.metrics.AutoTimer; import org.springframework.boot.actuate.metrics.AutoTimer;
import org.springframework.boot.actuate.metrics.data.DefaultRepositoryTagsProvider; import org.springframework.boot.actuate.metrics.data.DefaultRepositoryTagsProvider;
import org.springframework.boot.actuate.metrics.data.MetricsRepositoryMethodInvocationListener; import org.springframework.boot.actuate.metrics.data.MetricsRepositoryMethodInvocationListener;
...@@ -93,8 +92,8 @@ class RepositoryMetricsAutoConfigurationTests { ...@@ -93,8 +92,8 @@ class RepositoryMetricsAutoConfigurationTests {
@Test @Test
void metricNameCanBeConfigured() { void metricNameCanBeConfigured() {
this.contextRunner.withUserConfiguration(TestController.class) this.contextRunner.withPropertyValues("management.metrics.data.repository.metric-name=datarepo")
.withPropertyValues("management.metrics.data.repository.metric-name=datarepo").run((context) -> { .run((context) -> {
MeterRegistry registry = getInitializedMeterRegistry(context, ExampleRepository.class); MeterRegistry registry = getInitializedMeterRegistry(context, ExampleRepository.class);
Timer timer = registry.get("datarepo").timer(); Timer timer = registry.get("datarepo").timer();
assertThat(timer).isNotNull(); assertThat(timer).isNotNull();
...@@ -103,11 +102,8 @@ class RepositoryMetricsAutoConfigurationTests { ...@@ -103,11 +102,8 @@ class RepositoryMetricsAutoConfigurationTests {
@Test @Test
void autoTimeRequestsCanBeConfigured() { void autoTimeRequestsCanBeConfigured() {
this.contextRunner.withUserConfiguration(TestController.class) this.contextRunner.withPropertyValues("management.metrics.data.repository.autotime.enabled=true",
.withPropertyValues("management.metrics.data.repository.autotime.enabled=true", "management.metrics.data.repository.autotime.percentiles=0.5,0.7").run((context) -> {
"management.metrics.data.repository.autotime.percentiles=0.5,0.7",
"management.metrics.data.repository.autotime.percentiles-histogram=true")
.run((context) -> {
MeterRegistry registry = getInitializedMeterRegistry(context, ExampleRepository.class); MeterRegistry registry = getInitializedMeterRegistry(context, ExampleRepository.class);
Timer timer = registry.get("spring.data.repository.invocations").timer(); Timer timer = registry.get("spring.data.repository.invocations").timer();
HistogramSnapshot snapshot = timer.takeSnapshot(); HistogramSnapshot snapshot = timer.takeSnapshot();
...@@ -130,7 +126,7 @@ class RepositoryMetricsAutoConfigurationTests { ...@@ -130,7 +126,7 @@ class RepositoryMetricsAutoConfigurationTests {
} }
private MeterRegistry getInitializedMeterRegistry(AssertableApplicationContext context, private MeterRegistry getInitializedMeterRegistry(AssertableApplicationContext context,
Class<?> repositoryInterface) throws Exception { Class<?> repositoryInterface) {
MetricsRepositoryMethodInvocationListener listener = context MetricsRepositoryMethodInvocationListener listener = context
.getBean(MetricsRepositoryMethodInvocationListener.class); .getBean(MetricsRepositoryMethodInvocationListener.class);
ReflectionUtils.doWithLocalMethods(repositoryInterface, (method) -> { ReflectionUtils.doWithLocalMethods(repositoryInterface, (method) -> {
......
...@@ -48,7 +48,7 @@ dependencies { ...@@ -48,7 +48,7 @@ dependencies {
optional("org.mongodb:mongodb-driver-reactivestreams") optional("org.mongodb:mongodb-driver-reactivestreams")
optional("org.mongodb:mongodb-driver-sync") optional("org.mongodb:mongodb-driver-sync")
optional("org.neo4j.driver:neo4j-java-driver") optional("org.neo4j.driver:neo4j-java-driver")
optional("org.quartz-scheduler:quartz") optional("org.quartz-scheduler:quartz")
optional("org.springframework:spring-jdbc") optional("org.springframework:spring-jdbc")
optional("org.springframework:spring-messaging") optional("org.springframework:spring-messaging")
optional("org.springframework:spring-webflux") optional("org.springframework:spring-webflux")
......
...@@ -36,13 +36,13 @@ import org.springframework.util.ConcurrentReferenceHashMap; ...@@ -36,13 +36,13 @@ import org.springframework.util.ConcurrentReferenceHashMap;
*/ */
public final class TimedAnnotations { public final class TimedAnnotations {
private static Map<AnnotatedElement, Set<Timed>> cache = new ConcurrentReferenceHashMap<>(); private static final Map<AnnotatedElement, Set<Timed>> cache = new ConcurrentReferenceHashMap<>();
private TimedAnnotations() { private TimedAnnotations() {
} }
/** /**
* Return {@link Timed} annotation that should be used for the given {@code method} * Return {@link Timed} annotations that should be used for the given {@code method}
* and {@code type}. * and {@code type}.
* @param method the source method * @param method the source method
* @param type the source type * @param type the source type
......
...@@ -380,7 +380,7 @@ public class ServerProperties { ...@@ -380,7 +380,7 @@ public class ServerProperties {
/** /**
* Maximum number of HTTP requests that can be pipelined before the connection is * Maximum number of HTTP requests that can be pipelined before the connection is
* closed. When set to 0 or 1, keep-alive and pipelining are disabled. When set to * closed. When set to 0 or 1, keep-alive and pipelining are disabled. When set to
* -1, an unlimited number of pipelined or keep-alive requests is allowed. * -1, an unlimited number of pipelined or keep-alive requests are allowed.
*/ */
private int maxKeepAliveRequests = 100; private int maxKeepAliveRequests = 100;
......
...@@ -227,7 +227,6 @@ class ServerPropertiesTests { ...@@ -227,7 +227,6 @@ class ServerPropertiesTests {
@Test @Test
void testCustomizeTomcatKeepAliveTimeoutWithInfinite() { void testCustomizeTomcatKeepAliveTimeoutWithInfinite() {
bind("server.tomcat.keep-alive-timeout", "-1"); bind("server.tomcat.keep-alive-timeout", "-1");
assertThat(this.properties.getTomcat().getKeepAliveTimeout().toMillis()).isEqualTo(-1);
assertThat(this.properties.getTomcat().getKeepAliveTimeout()).hasMillis(-1); assertThat(this.properties.getTomcat().getKeepAliveTimeout()).hasMillis(-1);
} }
......
...@@ -2154,7 +2154,7 @@ The following JVM metrics are provided: ...@@ -2154,7 +2154,7 @@ The following JVM metrics are provided:
[[production-ready-metrics-system]] [[production-ready-metrics-system]]
==== System Metrics ==== System Metrics
Auto-configuration will enable system metrics using core Micrometer classes. Auto-configuration will enable system metrics using core Micrometer classes.
System are published under the `system.` and `process.` meter names. System metrics are published under the `system.` and `process.` meter names.
The following system metrics are provided: The following system metrics are provided:
......
...@@ -567,7 +567,7 @@ If `spring.config.location` contains directories (as opposed to files), they mus ...@@ -567,7 +567,7 @@ If `spring.config.location` contains directories (as opposed to files), they mus
At runtime they will be appended with the names generated from `spring.config.name` before being loaded. At runtime they will be appended with the names generated from `spring.config.name` before being loaded.
If `spring.config.location` contains files, they are used as-is. If `spring.config.location` contains files, they are used as-is.
Whether specified directly or contained in a directory, files references must include a file extension in their name. Whether specified directly or contained in a directory, file references must include a file extension in their name.
Typical extensions that are supported out-of-the-box are `.properties`, `.yaml`, and `.yml`. Typical extensions that are supported out-of-the-box are `.properties`, `.yaml`, and `.yml`.
When multiple locations are specified, the later ones can override the values of earlier ones. When multiple locations are specified, the later ones can override the values of earlier ones.
......
...@@ -151,9 +151,9 @@ class CloudPlatformTests { ...@@ -151,9 +151,9 @@ class CloudPlatformTests {
} }
@Test @Test
void getActiveWhenHasWebsitesEnableAppServiceStorageAndNoWebsiteNameShouldNotReturnAzureAppService() { void getActiveWhenHasWebsitesEnableAppServiceStorageAndNoWebsiteSiteNameShouldNotReturnAzureAppService() {
Environment environment = getEnvironmentWithEnvVariables( Environment environment = getEnvironmentWithEnvVariables(
Collections.singletonMap("WEBSITES_ENABLE_APP_SERVICE_STORAGE", "---")); Collections.singletonMap("WEBSITES_ENABLE_APP_SERVICE_STORAGE", "false"));
CloudPlatform platform = CloudPlatform.getActive(environment); CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isNull(); assertThat(platform).isNull();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment