Commit ef78cb33 authored by Stephane Nicoll's avatar Stephane Nicoll

Move metrics properties to "management.metrics"

Closes gh-11340
parent de8fe755
...@@ -37,7 +37,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -37,7 +37,7 @@ import org.springframework.context.annotation.Configuration;
class MeterBindersConfiguration { class MeterBindersConfiguration {
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.binders.jvmmemory.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.binders.jvmmemory.enabled", matchIfMissing = true)
@ConditionalOnMissingBean(JvmMemoryMetrics.class) @ConditionalOnMissingBean(JvmMemoryMetrics.class)
public JvmMemoryMetrics jvmMemoryMetrics() { public JvmMemoryMetrics jvmMemoryMetrics() {
return new JvmMemoryMetrics(); return new JvmMemoryMetrics();
...@@ -45,21 +45,21 @@ class MeterBindersConfiguration { ...@@ -45,21 +45,21 @@ class MeterBindersConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(LogbackMetrics.class) @ConditionalOnMissingBean(LogbackMetrics.class)
@ConditionalOnProperty(value = "spring.metrics.binders.logback.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.binders.logback.enabled", matchIfMissing = true)
@ConditionalOnClass(name = "ch.qos.logback.classic.Logger") @ConditionalOnClass(name = "ch.qos.logback.classic.Logger")
public LogbackMetrics logbackMetrics() { public LogbackMetrics logbackMetrics() {
return new LogbackMetrics(); return new LogbackMetrics();
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.binders.uptime.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.binders.uptime.enabled", matchIfMissing = true)
@ConditionalOnMissingBean(UptimeMetrics.class) @ConditionalOnMissingBean(UptimeMetrics.class)
public UptimeMetrics uptimeMetrics() { public UptimeMetrics uptimeMetrics() {
return new UptimeMetrics(); return new UptimeMetrics();
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.binders.processor.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.binders.processor.enabled", matchIfMissing = true)
@ConditionalOnMissingBean(ProcessorMetrics.class) @ConditionalOnMissingBean(ProcessorMetrics.class)
public ProcessorMetrics processorMetrics() { public ProcessorMetrics processorMetrics() {
return new ProcessorMetrics(); return new ProcessorMetrics();
......
...@@ -24,7 +24,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -24,7 +24,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Jon Schneider * @author Jon Schneider
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties("spring.metrics") @ConfigurationProperties("management.metrics")
public class MetricsProperties { public class MetricsProperties {
private Web web = new Web(); private Web web = new Web();
......
...@@ -47,7 +47,7 @@ public class AtlasExportConfiguration { ...@@ -47,7 +47,7 @@ public class AtlasExportConfiguration {
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.atlas.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.atlas.enabled", matchIfMissing = true)
public MetricsExporter atlasExporter(AtlasConfig atlasConfig, Clock clock) { public MetricsExporter atlasExporter(AtlasConfig atlasConfig, Clock clock) {
return () -> new AtlasMeterRegistry(atlasConfig, clock); return () -> new AtlasMeterRegistry(atlasConfig, clock);
} }
......
...@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @since 2.0.0 * @since 2.0.0
* @author Jon Schneider * @author Jon Schneider
*/ */
@ConfigurationProperties(prefix = "spring.metrics.export.atlas") @ConfigurationProperties(prefix = "management.metrics.export.atlas")
public class AtlasProperties extends StepRegistryProperties { public class AtlasProperties extends StepRegistryProperties {
/** /**
......
...@@ -36,7 +36,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -36,7 +36,7 @@ import org.springframework.context.annotation.Configuration;
*/ */
@Configuration @Configuration
@ConditionalOnClass(DatadogMeterRegistry.class) @ConditionalOnClass(DatadogMeterRegistry.class)
@ConditionalOnProperty("spring.metrics.export.datadog.api-key") @ConditionalOnProperty("management.metrics.export.datadog.api-key")
@EnableConfigurationProperties(DatadogProperties.class) @EnableConfigurationProperties(DatadogProperties.class)
public class DatadogExportConfiguration { public class DatadogExportConfiguration {
...@@ -47,7 +47,7 @@ public class DatadogExportConfiguration { ...@@ -47,7 +47,7 @@ public class DatadogExportConfiguration {
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.datadog.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.datadog.enabled", matchIfMissing = true)
public MetricsExporter datadogExporter(DatadogConfig datadogConfig, Clock clock) { public MetricsExporter datadogExporter(DatadogConfig datadogConfig, Clock clock) {
return () -> new DatadogMeterRegistry(datadogConfig, clock); return () -> new DatadogMeterRegistry(datadogConfig, clock);
} }
......
...@@ -25,7 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -25,7 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Jon Schneider * @author Jon Schneider
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties(prefix = "spring.metrics.export.datadog") @ConfigurationProperties(prefix = "management.metrics.export.datadog")
public class DatadogProperties extends StepRegistryProperties { public class DatadogProperties extends StepRegistryProperties {
/** /**
......
...@@ -47,7 +47,7 @@ public class GangliaExportConfiguration { ...@@ -47,7 +47,7 @@ public class GangliaExportConfiguration {
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.ganglia.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.ganglia.enabled", matchIfMissing = true)
public MetricsExporter gangliaExporter(GangliaConfig gangliaConfig, public MetricsExporter gangliaExporter(GangliaConfig gangliaConfig,
HierarchicalNameMapper nameMapper, Clock clock) { HierarchicalNameMapper nameMapper, Clock clock) {
return () -> new GangliaMeterRegistry(gangliaConfig, nameMapper, clock); return () -> new GangliaMeterRegistry(gangliaConfig, nameMapper, clock);
......
...@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Jon Schneider * @author Jon Schneider
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties(prefix = "spring.metrics.export.ganglia") @ConfigurationProperties(prefix = "management.metrics.export.ganglia")
public class GangliaProperties { public class GangliaProperties {
/** /**
......
...@@ -47,7 +47,7 @@ public class GraphiteExportConfiguration { ...@@ -47,7 +47,7 @@ public class GraphiteExportConfiguration {
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.graphite.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.graphite.enabled", matchIfMissing = true)
public MetricsExporter graphiteExporter(GraphiteConfig graphiteConfig, public MetricsExporter graphiteExporter(GraphiteConfig graphiteConfig,
HierarchicalNameMapper nameMapper, Clock clock) { HierarchicalNameMapper nameMapper, Clock clock) {
return () -> new GraphiteMeterRegistry(graphiteConfig, nameMapper, clock); return () -> new GraphiteMeterRegistry(graphiteConfig, nameMapper, clock);
......
...@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Jon Schneider * @author Jon Schneider
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties(prefix = "spring.metrics.export.graphite") @ConfigurationProperties(prefix = "management.metrics.export.graphite")
public class GraphiteProperties { public class GraphiteProperties {
/** /**
......
...@@ -46,7 +46,7 @@ public class InfluxExportConfiguration { ...@@ -46,7 +46,7 @@ public class InfluxExportConfiguration {
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.influx.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.influx.enabled", matchIfMissing = true)
public MetricsExporter influxExporter(InfluxConfig influxConfig, Clock clock) { public MetricsExporter influxExporter(InfluxConfig influxConfig, Clock clock) {
return () -> new InfluxMeterRegistry(influxConfig, clock); return () -> new InfluxMeterRegistry(influxConfig, clock);
} }
......
...@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Jon Schneider * @author Jon Schneider
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties(prefix = "spring.metrics.export.influx") @ConfigurationProperties(prefix = "management.metrics.export.influx")
public class InfluxProperties extends StepRegistryProperties { public class InfluxProperties extends StepRegistryProperties {
/** /**
......
...@@ -38,7 +38,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -38,7 +38,7 @@ import org.springframework.context.annotation.Configuration;
public class JmxExportConfiguration { public class JmxExportConfiguration {
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.jmx.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.jmx.enabled", matchIfMissing = true)
public MetricsExporter jmxExporter(HierarchicalNameMapper nameMapper, Clock clock) { public MetricsExporter jmxExporter(HierarchicalNameMapper nameMapper, Clock clock) {
return () -> new JmxMeterRegistry(nameMapper, clock); return () -> new JmxMeterRegistry(nameMapper, clock);
} }
......
...@@ -49,7 +49,7 @@ public class PrometheusExportConfiguration { ...@@ -49,7 +49,7 @@ public class PrometheusExportConfiguration {
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.prometheus.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.prometheus.enabled", matchIfMissing = true)
public MetricsExporter prometheusExporter(PrometheusConfig prometheusConfig, public MetricsExporter prometheusExporter(PrometheusConfig prometheusConfig,
CollectorRegistry collectorRegistry, Clock clock) { CollectorRegistry collectorRegistry, Clock clock) {
return () -> new PrometheusMeterRegistry(prometheusConfig, collectorRegistry, return () -> new PrometheusMeterRegistry(prometheusConfig, collectorRegistry,
......
...@@ -26,7 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -26,7 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Jon Schneider * @author Jon Schneider
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties(prefix = "spring.metrics.export.prometheus") @ConfigurationProperties(prefix = "management.metrics.export.prometheus")
public class PrometheusProperties { public class PrometheusProperties {
/** /**
......
...@@ -38,7 +38,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -38,7 +38,7 @@ import org.springframework.context.annotation.Configuration;
public class SimpleExportConfiguration { public class SimpleExportConfiguration {
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.simple.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.simple.enabled", matchIfMissing = true)
@ConditionalOnMissingBean(MetricsExporter.class) @ConditionalOnMissingBean(MetricsExporter.class)
public MetricsExporter simpleExporter(SimpleConfig config, Clock clock) { public MetricsExporter simpleExporter(SimpleConfig config, Clock clock) {
return () -> new SimpleMeterRegistry(config, clock); return () -> new SimpleMeterRegistry(config, clock);
......
...@@ -30,7 +30,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -30,7 +30,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Jon Schneider * @author Jon Schneider
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties(prefix = "spring.metrics.export.simple") @ConfigurationProperties(prefix = "management.metrics.export.simple")
public class SimpleProperties { public class SimpleProperties {
/** /**
......
...@@ -47,7 +47,7 @@ public class StatsdExportConfiguration { ...@@ -47,7 +47,7 @@ public class StatsdExportConfiguration {
} }
@Bean @Bean
@ConditionalOnProperty(value = "spring.metrics.export.statsd.enabled", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.export.statsd.enabled", matchIfMissing = true)
public MetricsExporter statsdExporter(StatsdConfig statsdConfig, public MetricsExporter statsdExporter(StatsdConfig statsdConfig,
HierarchicalNameMapper hierarchicalNameMapper, Clock clock) { HierarchicalNameMapper hierarchicalNameMapper, Clock clock) {
return () -> new StatsdMeterRegistry(statsdConfig, hierarchicalNameMapper, clock); return () -> new StatsdMeterRegistry(statsdConfig, hierarchicalNameMapper, clock);
......
...@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties(prefix = "spring.metrics.export.statsd") @ConfigurationProperties(prefix = "management.metrics.export.statsd")
public class StatsdProperties { public class StatsdProperties {
/** /**
......
...@@ -43,7 +43,7 @@ import org.springframework.util.StringUtils; ...@@ -43,7 +43,7 @@ import org.springframework.util.StringUtils;
*/ */
@Configuration @Configuration
@ConditionalOnBean({ DataSource.class, DataSourcePoolMetadataProvider.class }) @ConditionalOnBean({ DataSource.class, DataSourcePoolMetadataProvider.class })
@ConditionalOnProperty(value = "spring.metrics.jdbc.instrument-datasource", matchIfMissing = true) @ConditionalOnProperty(value = "management.metrics.jdbc.instrument-datasource", matchIfMissing = true)
@EnableConfigurationProperties(JdbcMetricsProperties.class) @EnableConfigurationProperties(JdbcMetricsProperties.class)
public class DataSourcePoolMetricsConfiguration { public class DataSourcePoolMetricsConfiguration {
......
...@@ -24,7 +24,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -24,7 +24,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties("spring.metrics.jdbc") @ConfigurationProperties("management.metrics.jdbc")
public class JdbcMetricsProperties { public class JdbcMetricsProperties {
/** /**
......
...@@ -186,31 +186,31 @@ ...@@ -186,31 +186,31 @@
"defaultValue": true "defaultValue": true
}, },
{ {
"name": "spring.metrics.binders.jvmmemory.enabled", "name": "management.metrics.binders.jvmmemory.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Whether to enable JVM memory metrics.", "description": "Whether to enable JVM memory metrics.",
"defaultValue": true "defaultValue": true
}, },
{ {
"name": "spring.metrics.binders.logback.enabled", "name": "management.metrics.binders.logback.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Whether to enable Logback metrics.", "description": "Whether to enable Logback metrics.",
"defaultValue": true "defaultValue": true
}, },
{ {
"name": "spring.metrics.binders.processor.enabled", "name": "management.metrics.binders.processor.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Whether to enable processor metrics.", "description": "Whether to enable processor metrics.",
"defaultValue": true "defaultValue": true
}, },
{ {
"name": "spring.metrics.binders.uptime.enabled", "name": "management.metrics.binders.uptime.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Whether to enable uptime metrics.", "description": "Whether to enable uptime metrics.",
"defaultValue": true "defaultValue": true
}, },
{ {
"name": "spring.metrics.jdbc.instrument-datasource", "name": "management.metrics.jdbc.instrument-datasource",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Instrument all available data sources.", "description": "Instrument all available data sources.",
"defaultValue": true "defaultValue": true
...@@ -1516,7 +1516,6 @@ ...@@ -1516,7 +1516,6 @@
"description": "Key for redis repository export (if active). Should be globally unique for a\n system sharing a redis repository across multiple processes.", "description": "Key for redis repository export (if active). Should be globally unique for a\n system sharing a redis repository across multiple processes.",
"defaultValue": "keys.spring.metrics", "defaultValue": "keys.spring.metrics",
"deprecation": { "deprecation": {
"replacement": "spring.sendgrid.api-key",
"reason": "Metrics support is now using Micrometer.", "reason": "Metrics support is now using Micrometer.",
"level": "error" "level": "error"
} }
...@@ -1540,6 +1539,25 @@ ...@@ -1540,6 +1539,25 @@
"level": "error" "level": "error"
} }
}, },
{
"name": "spring.metrics.export.statsd.host",
"type": "java.lang.String",
"description": "Host of a statsd server to receive exported metrics.",
"deprecation": {
"replacement": "management.metrics.export.statsd.host",
"level": "error"
}
},
{
"name": "spring.metrics.export.statsd.port",
"type": "java.lang.Integer",
"description": "Port of a statsd server to receive exported metrics.",
"defaultValue": 8125,
"deprecation": {
"replacement": "management.metrics.export.statsd.port",
"level": "error"
}
},
{ {
"name": "spring.metrics.export.statsd.prefix", "name": "spring.metrics.export.statsd.prefix",
"type": "java.lang.String", "type": "java.lang.String",
......
...@@ -70,14 +70,14 @@ public class WebEndpointsAutoConfigurationIntegrationTests { ...@@ -70,14 +70,14 @@ public class WebEndpointsAutoConfigurationIntegrationTests {
return new WebApplicationContextRunner() return new WebApplicationContextRunner()
.withConfiguration( .withConfiguration(
UserConfigurations.of(WebEndpointTestApplication.class)) UserConfigurations.of(WebEndpointTestApplication.class))
.withPropertyValues("spring.metrics.export.statsd.enabled:false"); .withPropertyValues("management.metrics.export.statsd.enabled:false");
} }
private ReactiveWebApplicationContextRunner reactiveWebRunner() { private ReactiveWebApplicationContextRunner reactiveWebRunner() {
return new ReactiveWebApplicationContextRunner() return new ReactiveWebApplicationContextRunner()
.withConfiguration( .withConfiguration(
UserConfigurations.of(WebEndpointTestApplication.class)) UserConfigurations.of(WebEndpointTestApplication.class))
.withPropertyValues("spring.metrics.export.statsd.enabled:false"); .withPropertyValues("management.metrics.export.statsd.enabled:false");
} }
@EnableAutoConfiguration(exclude = { FlywayAutoConfiguration.class, @EnableAutoConfiguration(exclude = { FlywayAutoConfiguration.class,
......
...@@ -67,7 +67,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat ...@@ -67,7 +67,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = MetricsAutoConfigurationIntegrationTests.MetricsApp.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = MetricsAutoConfigurationIntegrationTests.MetricsApp.class)
@TestPropertySource(properties = "spring.metrics.use-global-registry=false") @TestPropertySource(properties = "management.metrics.use-global-registry=false")
public class MetricsAutoConfigurationIntegrationTests { public class MetricsAutoConfigurationIntegrationTests {
@Autowired @Autowired
......
...@@ -50,7 +50,7 @@ public class MetricsAutoConfigurationTests { ...@@ -50,7 +50,7 @@ public class MetricsAutoConfigurationTests {
.withConfiguration( .withConfiguration(
AutoConfigurations.of(DataSourceAutoConfiguration.class)) AutoConfigurations.of(DataSourceAutoConfiguration.class))
.withPropertyValues("spring.datasource.generate-unique-name=true", .withPropertyValues("spring.datasource.generate-unique-name=true",
"spring.metrics.use-global-registry=false") "management.metrics.use-global-registry=false")
.run((context) -> { .run((context) -> {
context.getBean(DataSource.class).getConnection().getMetaData(); context.getBean(DataSource.class).getConnection().getMetaData();
MeterRegistry registry = context.getBean(MeterRegistry.class); MeterRegistry registry = context.getBean(MeterRegistry.class);
...@@ -65,8 +65,8 @@ public class MetricsAutoConfigurationTests { ...@@ -65,8 +65,8 @@ public class MetricsAutoConfigurationTests {
.withConfiguration( .withConfiguration(
AutoConfigurations.of(DataSourceAutoConfiguration.class)) AutoConfigurations.of(DataSourceAutoConfiguration.class))
.withPropertyValues("spring.datasource.generate-unique-name=true", .withPropertyValues("spring.datasource.generate-unique-name=true",
"spring.metrics.jdbc.datasource-metric-name=custom.name", "management.metrics.jdbc.datasource-metric-name=custom.name",
"spring.metrics.use-global-registry=false") "management.metrics.use-global-registry=false")
.run((context) -> { .run((context) -> {
context.getBean(DataSource.class).getConnection().getMetaData(); context.getBean(DataSource.class).getConnection().getMetaData();
MeterRegistry registry = context.getBean(MeterRegistry.class); MeterRegistry registry = context.getBean(MeterRegistry.class);
...@@ -81,8 +81,8 @@ public class MetricsAutoConfigurationTests { ...@@ -81,8 +81,8 @@ public class MetricsAutoConfigurationTests {
.withConfiguration( .withConfiguration(
AutoConfigurations.of(DataSourceAutoConfiguration.class)) AutoConfigurations.of(DataSourceAutoConfiguration.class))
.withPropertyValues("spring.datasource.generate-unique-name=true", .withPropertyValues("spring.datasource.generate-unique-name=true",
"spring.metrics.jdbc.instrument-datasource=false", "management.metrics.jdbc.instrument-datasource=false",
"spring.metrics.use-global-registry=false") "management.metrics.use-global-registry=false")
.run((context) -> { .run((context) -> {
context.getBean(DataSource.class).getConnection().getMetaData(); context.getBean(DataSource.class).getConnection().getMetaData();
MeterRegistry registry = context.getBean(MeterRegistry.class); MeterRegistry registry = context.getBean(MeterRegistry.class);
......
...@@ -39,14 +39,14 @@ public class SimpleExportConfigurationTests { ...@@ -39,14 +39,14 @@ public class SimpleExportConfigurationTests {
@Test @Test
public void simpleMeterRegistryIsInTheCompositeWhenNoOtherRegistryIs() { public void simpleMeterRegistryIsInTheCompositeWhenNoOtherRegistryIs() {
new ApplicationContextRunner() new ApplicationContextRunner()
.withPropertyValues("spring.metrics.export.atlas.enabled=false", .withPropertyValues("management.metrics.export.atlas.enabled=false",
"spring.metrics.export.datadog.enabled=false", "management.metrics.export.datadog.enabled=false",
"spring.metrics.export.ganglia.enabled=false", "management.metrics.export.ganglia.enabled=false",
"spring.metrics.export.graphite.enabled=false", "management.metrics.export.graphite.enabled=false",
"spring.metrics.export.influx.enabled=false", "management.metrics.export.influx.enabled=false",
"spring.metrics.export.jmx.enabled=false", "management.metrics.export.jmx.enabled=false",
"spring.metrics.export.prometheus.enabled=false", "management.metrics.export.prometheus.enabled=false",
"spring.metrics.export.statsd.enabled=false") "management.metrics.export.statsd.enabled=false")
.withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class)) .withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class))
.run((context) -> { .run((context) -> {
CompositeMeterRegistry meterRegistry = context CompositeMeterRegistry meterRegistry = context
......
...@@ -934,12 +934,12 @@ its https://micrometer.io/docs[reference documentation]. ...@@ -934,12 +934,12 @@ its https://micrometer.io/docs[reference documentation].
[[production-ready-metrics-spring-mvc]] [[production-ready-metrics-spring-mvc]]
=== Spring MVC Metrics === Spring MVC Metrics
Auto-configuration enables the instrumentation of requests handled by Spring MVC. When Auto-configuration enables the instrumentation of requests handled by Spring MVC. When
`spring.metrics.web.server.auto-time-requests` is `true`, this instrumentation occurs for `management.metrics.web.server.auto-time-requests` is `true`, this instrumentation occurs
all requests. Alternatively, when set to `false`, you can enable instrumentation by for all requests. Alternatively, when set to `false`, you can enable instrumentation by
adding `@Timed` to a request-handling method. adding `@Timed` to a request-handling method.
By default, metrics are generated with the name, `http.server.requests`. The name can be By default, metrics are generated with the name, `http.server.requests`. The name can be
customized by setting the `spring.metrics.web.server.requests-metrics-name` property. customized by setting the `management.metrics.web.server.requests-metrics-name` property.
...@@ -962,7 +962,7 @@ controllers. You can also use a helper class, `RouterFunctionMetrics`, to instru ...@@ -962,7 +962,7 @@ controllers. You can also use a helper class, `RouterFunctionMetrics`, to instru
applications that use WebFlux's functional programming model. applications that use WebFlux's functional programming model.
By default, metrics are generated with the name `http.server.requests`. You can customize By default, metrics are generated with the name `http.server.requests`. You can customize
the name by setting the `spring.metrics.web.server.requests-metrics-name` property. the name by setting the `management.metrics.web.server.requests-metrics-name` property.
...@@ -997,7 +997,7 @@ instrumentation of its requests. `MetricsRestTemplateCustomizer` can be used to ...@@ -997,7 +997,7 @@ instrumentation of its requests. `MetricsRestTemplateCustomizer` can be used to
your own `RestTemplate` instances. your own `RestTemplate` instances.
By default, metrics are generated with the name, `http.client.requests`. The name can be By default, metrics are generated with the name, `http.client.requests`. The name can be
customized by setting the `spring.metrics.web.client.requests-metrics-name` property. customized by setting the `management.metrics.web.client.requests-metrics-name` property.
...@@ -1019,7 +1019,7 @@ Auto-configuration will enable the instrumentation of all available ``DataSource ...@@ -1019,7 +1019,7 @@ Auto-configuration will enable the instrumentation of all available ``DataSource
metric named `data.source`. Data source instrumentation results in gauges representing metric named `data.source`. Data source instrumentation results in gauges representing
the currently active, maximum allowed, and minimum allowed connections in the pool. Each the currently active, maximum allowed, and minimum allowed connections in the pool. Each
of these gauges has a name which is prefixed by `data.source` by default. The prefix can of these gauges has a name which is prefixed by `data.source` by default. The prefix can
be customized by using the `spring.metrics.jdbc.datasource-metric-name` property. be customized by using the `management.metrics.jdbc.datasource-metric-name` property.
Metrics will also be tagged by the name of the `DataSource` computed based on the bean Metrics will also be tagged by the name of the `DataSource` computed based on the bean
name. name.
......
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