Harmonize metric property names

See gh-11667
pull/11680/head
Stephane Nicoll 7 years ago
parent efd941bbe0
commit 8704cf1fe7

@ -30,14 +30,14 @@ public class CacheMetricsProperties {
/** /**
* Name of the metric for cache usage. * Name of the metric for cache usage.
*/ */
private String cacheMetricName = "cache"; private String metricName = "cache";
public String getCacheMetricName() { public String getMetricName() {
return this.cacheMetricName; return this.metricName;
} }
public void setCacheMetricName(String cacheMetricName) { public void setMetricName(String metricName) {
this.cacheMetricName = cacheMetricName; this.metricName = metricName;
} }
} }

@ -66,7 +66,7 @@ class CacheMetricsRegistrarConfiguration {
@Bean @Bean
public CacheMetricsRegistrar cacheMetricsRegistrar() { public CacheMetricsRegistrar cacheMetricsRegistrar() {
return new CacheMetricsRegistrar(this.registry, return new CacheMetricsRegistrar(this.registry,
this.properties.getCacheMetricName(), this.binderProviders); this.properties.getMetricName(), this.binderProviders);
} }
@PostConstruct @PostConstruct

@ -60,7 +60,7 @@ public class DataSourcePoolMetricsConfiguration {
JdbcMetricsProperties jdbcMetricsProperties) { JdbcMetricsProperties jdbcMetricsProperties) {
this.registry = registry; this.registry = registry;
this.metadataProviders = metadataProviders; this.metadataProviders = metadataProviders;
this.metricName = jdbcMetricsProperties.getDatasourceMetricName(); this.metricName = jdbcMetricsProperties.getMetricName();
} }
@Autowired @Autowired

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,14 +30,14 @@ public class JdbcMetricsProperties {
/** /**
* Name of the metric for data source usage. * Name of the metric for data source usage.
*/ */
private String datasourceMetricName = "data.source"; private String metricName = "data.source";
public String getDatasourceMetricName() { public String getMetricName() {
return this.datasourceMetricName; return this.metricName;
} }
public void setDatasourceMetricName(String datasourceMetricName) { public void setMetricName(String metricName) {
this.datasourceMetricName = datasourceMetricName; this.metricName = metricName;
} }
} }

@ -65,7 +65,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",
"management.metrics.jdbc.datasource-metric-name=custom.name") "management.metrics.jdbc.metric-name=custom.name")
.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);

@ -59,7 +59,7 @@ public class CacheMetricsConfigurationTests {
public void autoConfiguredCacheManagerWithCustomMetricName() { public void autoConfiguredCacheManagerWithCustomMetricName() {
this.contextRunner this.contextRunner
.withPropertyValues( .withPropertyValues(
"management.metrics.cache.cache-metric-name=custom.name", "management.metrics.cache.metric-name=custom.name",
"spring.cache.type=caffeine", "spring.cache.cache-names=cache1") "spring.cache.type=caffeine", "spring.cache.cache-names=cache1")
.run((context) -> { .run((context) -> {
MeterRegistry registry = context.getBean(MeterRegistry.class); MeterRegistry registry = context.getBean(MeterRegistry.class);

@ -1281,7 +1281,7 @@ content into your application. Rather, pick only the properties that you need.
management.metrics.binders.logback.enabled=true # Whether to enable Logback metrics. management.metrics.binders.logback.enabled=true # Whether to enable Logback metrics.
management.metrics.binders.processor.enabled=true # Whether to enable processor metrics. management.metrics.binders.processor.enabled=true # Whether to enable processor metrics.
management.metrics.binders.uptime.enabled=true # Whether to enable uptime metrics. management.metrics.binders.uptime.enabled=true # Whether to enable uptime metrics.
management.metrics.cache.cache-metric-name=cache # Name of the metric for cache usage. management.metrics.cache.metric-name=cache # Name of the metric for cache usage.
management.metrics.cache.instrument=true # Instrument all available caches. management.metrics.cache.instrument=true # Instrument all available caches.
management.metrics.export.atlas.batch-size= # Number of measurements per request to use for the backend. If more measurements are found, then multiple requests will be made. management.metrics.export.atlas.batch-size= # Number of measurements per request to use for the backend. If more measurements are found, then multiple requests will be made.
management.metrics.export.atlas.config-refresh-frequency= # Frequency for refreshing config settings from the LWC service. management.metrics.export.atlas.config-refresh-frequency= # Frequency for refreshing config settings from the LWC service.
@ -1351,7 +1351,7 @@ content into your application. Rather, pick only the properties that you need.
management.metrics.export.statsd.polling-frequency=10s # How often gauges will be polled. When a gauge is polled, its value is recalculated and if the value has changed, it is sent to the StatsD server. management.metrics.export.statsd.polling-frequency=10s # How often gauges will be polled. When a gauge is polled, its value is recalculated and if the value has changed, it is sent to the StatsD server.
management.metrics.export.statsd.port=8125 # Port of the StatsD server to receive exported metrics. management.metrics.export.statsd.port=8125 # Port of the StatsD server to receive exported metrics.
management.metrics.export.statsd.queue-size=2147483647 # Maximum size of the queue of items waiting to be sent to the StatsD server. management.metrics.export.statsd.queue-size=2147483647 # Maximum size of the queue of items waiting to be sent to the StatsD server.
management.metrics.jdbc.datasource-metric-name=data.source # Name of the metric for data source usage. management.metrics.jdbc.metric-name=data.source # Name of the metric for data source usage.
management.metrics.jdbc.instrument=true # Instrument all available data sources. management.metrics.jdbc.instrument=true # Instrument all available data sources.
management.metrics.rabbitmq.instrument=true # Instrument all available connection factories. management.metrics.rabbitmq.instrument=true # Instrument all available connection factories.
management.metrics.rabbitmq.metric-name=rabbitmq # Name of the metric for RabbitMQ usage. management.metrics.rabbitmq.metric-name=rabbitmq # Name of the metric for RabbitMQ usage.

@ -1035,7 +1035,7 @@ following information:
=== Cache metrics === Cache metrics
Auto-configuration will enable the instrumentation of all available ``Cache``s on startup Auto-configuration will enable the instrumentation of all available ``Cache``s on startup
with a metric named `cache`. The prefix can be customized by using the with a metric named `cache`. The prefix can be customized by using the
`management.metrics.cache.cache-metric-name` property. Cache instrumentation is specific `management.metrics.cache.metric-name` property. Cache instrumentation is specific
to each cache library, refer to https://micrometer.io/docs[the micrometer documentation] to each cache library, refer to https://micrometer.io/docs[the micrometer documentation]
for more details. for more details.
@ -1061,7 +1061,7 @@ Auto-configuration enables the instrumentation of all available ``DataSource`` o
with a metric named `data.source`. Data source instrumentation results in gauges with a metric named `data.source`. Data source instrumentation results in gauges
representing the currently active, maximum allowed, and minimum allowed connections in the representing the currently active, maximum allowed, and minimum allowed connections in the
pool. Each of these gauges has a name that is prefixed by `data.source` by default. The pool. Each of these gauges has a name that is prefixed by `data.source` by default. The
prefix can be customized by setting the `management.metrics.jdbc.datasource-metric-name` prefix can be customized by setting the `management.metrics.jdbc.metric-name`
property. property.
Metrics are also tagged by the name of the `DataSource` computed based on the bean name. Metrics are also tagged by the name of the `DataSource` computed based on the bean name.

Loading…
Cancel
Save