Polish
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.config;
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics;
|
||||
|
||||
import io.micrometer.core.instrument.config.MissingRequiredConfigurationException;
|
||||
|
||||
@@ -68,8 +68,8 @@ public class RabbitMetricsAutoConfiguration {
|
||||
ConnectionFactory rabbitConnectionFactory = connectionFactory
|
||||
.getRabbitConnectionFactory();
|
||||
String connectionFactoryName = getConnectionFactoryName(beanName);
|
||||
new RabbitMetrics(rabbitConnectionFactory,
|
||||
Tags.of("name", connectionFactoryName)).bindTo(this.registry);
|
||||
new RabbitMetrics(rabbitConnectionFactory, Tags.of("name", connectionFactoryName))
|
||||
.bindTo(this.registry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
||||
@@ -69,8 +69,8 @@ public class DataSourcePoolMetricsAutoConfiguration {
|
||||
|
||||
private void bindDataSourceToRegistry(String beanName, DataSource dataSource) {
|
||||
String dataSourceName = getDataSourceName(beanName);
|
||||
new DataSourcePoolMetrics(dataSource, this.metadataProviders,
|
||||
dataSourceName, Collections.emptyList()).bindTo(this.registry);
|
||||
new DataSourcePoolMetrics(dataSource, this.metadataProviders, dataSourceName,
|
||||
Collections.emptyList()).bindTo(this.registry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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,8 +41,7 @@ class MongoHealthIndicatorConfiguration extends
|
||||
|
||||
private final Map<String, MongoTemplate> mongoTemplates;
|
||||
|
||||
MongoHealthIndicatorConfiguration(
|
||||
Map<String, MongoTemplate> mongoTemplates) {
|
||||
MongoHealthIndicatorConfiguration(Map<String, MongoTemplate> mongoTemplates) {
|
||||
this.mongoTemplates = mongoTemplates;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,5 +75,6 @@ org.springframework.boot.actuate.autoconfigure.web.jersey.JerseyManagementChildC
|
||||
org.springframework.boot.actuate.autoconfigure.web.reactive.ReactiveManagementChildContextConfiguration,\
|
||||
org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementChildContextConfiguration,\
|
||||
org.springframework.boot.actuate.autoconfigure.web.servlet.WebMvcEndpointChildContextConfiguration
|
||||
|
||||
org.springframework.boot.diagnostics.FailureAnalyzer=\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.config.MissingRequiredConfigurationFailureAnalyzer
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.MissingRequiredConfigurationFailureAnalyzer
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.config;
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics;
|
||||
|
||||
import io.micrometer.core.instrument.Clock;
|
||||
import io.micrometer.newrelic.NewRelicConfig;
|
||||
@@ -47,8 +47,7 @@ public class RabbitMetricsAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void rabbitmqNativeConnectionFactoryInstrumentationCanBeDisabled() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("management.metrics.enable.rabbitmq=false")
|
||||
this.contextRunner.withPropertyValues("management.metrics.enable.rabbitmq=false")
|
||||
.run((context) -> {
|
||||
MeterRegistry registry = context.getBean(MeterRegistry.class);
|
||||
assertThat(registry.find("rabbitmq.connections").meter()).isNull();
|
||||
|
||||
@@ -88,8 +88,7 @@ public class DataSourcePoolMetricsAutoConfigurationTests {
|
||||
context.getBean("secondOne", DataSource.class).getConnection()
|
||||
.getMetaData();
|
||||
MeterRegistry registry = context.getBean(MeterRegistry.class);
|
||||
registry.get("jdbc.max.connections").tags("name", "first")
|
||||
.meter();
|
||||
registry.get("jdbc.max.connections").tags("name", "first").meter();
|
||||
registry.get("jdbc.max.connections").tags("name", "secondOne")
|
||||
.meter();
|
||||
});
|
||||
|
||||
@@ -39,8 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class MongoReactiveHealthIndicatorConfigurationTests {
|
||||
|
||||
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(
|
||||
MongoAutoConfiguration.class,
|
||||
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class,
|
||||
MongoDataAutoConfiguration.class,
|
||||
MongoReactiveAutoConfiguration.class,
|
||||
MongoReactiveDataAutoConfiguration.class,
|
||||
@@ -49,10 +48,10 @@ public class MongoReactiveHealthIndicatorConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void runShouldCreateIndicator() {
|
||||
this.contextRunner.run(
|
||||
(context) -> assertThat(context).hasSingleBean(MongoReactiveHealthIndicator.class)
|
||||
.doesNotHaveBean(MongoHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(MongoReactiveHealthIndicator.class)
|
||||
.doesNotHaveBean(MongoHealthIndicator.class)
|
||||
.doesNotHaveBean(ApplicationHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user