parent
efd941bbe0
commit
8704cf1fe7
|
|
@ -30,14 +30,14 @@ public class CacheMetricsProperties {
|
|||
/**
|
||||
* Name of the metric for cache usage.
|
||||
*/
|
||||
private String cacheMetricName = "cache";
|
||||
private String metricName = "cache";
|
||||
|
||||
public String getCacheMetricName() {
|
||||
return this.cacheMetricName;
|
||||
public String getMetricName() {
|
||||
return this.metricName;
|
||||
}
|
||||
|
||||
public void setCacheMetricName(String cacheMetricName) {
|
||||
this.cacheMetricName = cacheMetricName;
|
||||
public void setMetricName(String metricName) {
|
||||
this.metricName = metricName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class CacheMetricsRegistrarConfiguration {
|
|||
@Bean
|
||||
public CacheMetricsRegistrar cacheMetricsRegistrar() {
|
||||
return new CacheMetricsRegistrar(this.registry,
|
||||
this.properties.getCacheMetricName(), this.binderProviders);
|
||||
this.properties.getMetricName(), this.binderProviders);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class DataSourcePoolMetricsConfiguration {
|
|||
JdbcMetricsProperties jdbcMetricsProperties) {
|
||||
this.registry = registry;
|
||||
this.metadataProviders = metadataProviders;
|
||||
this.metricName = jdbcMetricsProperties.getDatasourceMetricName();
|
||||
this.metricName = jdbcMetricsProperties.getMetricName();
|
||||
}
|
||||
|
||||
@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");
|
||||
* 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.
|
||||
*/
|
||||
private String datasourceMetricName = "data.source";
|
||||
private String metricName = "data.source";
|
||||
|
||||
public String getDatasourceMetricName() {
|
||||
return this.datasourceMetricName;
|
||||
public String getMetricName() {
|
||||
return this.metricName;
|
||||
}
|
||||
|
||||
public void setDatasourceMetricName(String datasourceMetricName) {
|
||||
this.datasourceMetricName = datasourceMetricName;
|
||||
public void setMetricName(String metricName) {
|
||||
this.metricName = metricName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class MetricsAutoConfigurationTests {
|
|||
.withConfiguration(
|
||||
AutoConfigurations.of(DataSourceAutoConfiguration.class))
|
||||
.withPropertyValues("spring.datasource.generate-unique-name=true",
|
||||
"management.metrics.jdbc.datasource-metric-name=custom.name")
|
||||
"management.metrics.jdbc.metric-name=custom.name")
|
||||
.run((context) -> {
|
||||
context.getBean(DataSource.class).getConnection().getMetaData();
|
||||
MeterRegistry registry = context.getBean(MeterRegistry.class);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class CacheMetricsConfigurationTests {
|
|||
public void autoConfiguredCacheManagerWithCustomMetricName() {
|
||||
this.contextRunner
|
||||
.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")
|
||||
.run((context) -> {
|
||||
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.processor.enabled=true # Whether to enable processor 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.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.
|
||||
|
|
@ -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.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.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.rabbitmq.instrument=true # Instrument all available connection factories.
|
||||
management.metrics.rabbitmq.metric-name=rabbitmq # Name of the metric for RabbitMQ usage.
|
||||
|
|
|
|||
|
|
@ -1035,7 +1035,7 @@ following information:
|
|||
=== Cache metrics
|
||||
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
|
||||
`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]
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
Metrics are also tagged by the name of the `DataSource` computed based on the bean name.
|
||||
|
|
|
|||
Loading…
Reference in New Issue