Polish "Remove unnecessary config options for metrics"

Closes gh-12017"
pull/12022/merge
Stephane Nicoll 7 years ago
parent 49f21a2264
commit b28cabdb12

@ -80,8 +80,8 @@ public class DataSourcePoolMetrics implements MeterBinder {
bindDataSource(registry, metricName, this.metadataProvider.getValueFunction(function)); bindDataSource(registry, metricName, this.metadataProvider.getValueFunction(function));
} }
private <N extends Number> void bindDataSource(MeterRegistry registry, String metricName, private <N extends Number> void bindDataSource(MeterRegistry registry,
Function<DataSource, N> function) { String metricName, Function<DataSource, N> function) {
if (function.apply(this.dataSource) != null) { if (function.apply(this.dataSource) != null) {
registry.gauge("jdbc." + metricName + ".connections", this.tags, registry.gauge("jdbc." + metricName + ".connections", this.tags,
this.dataSource, (m) -> function.apply(m).doubleValue()); this.dataSource, (m) -> function.apply(m).doubleValue());

@ -47,7 +47,8 @@ public class RabbitMetricsTests {
.bindTo(registry); .bindTo(registry);
assertThat(registry.get("rabbitmq.connections").tags("env", "prod").meter()) assertThat(registry.get("rabbitmq.connections").tags("env", "prod").meter())
.isNotNull(); .isNotNull();
assertThat(registry.find("rabbitmq.connections").tags("env", "dev").meter()).isNull(); assertThat(registry.find("rabbitmq.connections").tags("env", "dev").meter())
.isNull();
} }
} }

@ -1300,7 +1300,6 @@ 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.instrument=true # Instrument all available caches.
management.metrics.distribution.percentiles-histogram.*= # Whether meter IDs starting-with the specified name should be publish percentile histograms. management.metrics.distribution.percentiles-histogram.*= # Whether meter IDs starting-with the specified name should be publish percentile histograms.
management.metrics.distribution.percentiles.*= # Specific computed non-aggregable percentiles to ship to the backend for meter IDs starting-with the specified name. management.metrics.distribution.percentiles.*= # Specific computed non-aggregable percentiles to ship to the backend for meter IDs starting-with the specified name.
management.metrics.distribution.sla.*= Specific SLA boundaries for meter IDs starting-with the specified name. The longest match wins, the key `all` can also be used to configure all meters. management.metrics.distribution.sla.*= Specific SLA boundaries for meter IDs starting-with the specified name. The longest match wins, the key `all` can also be used to configure all meters.
@ -1391,10 +1390,6 @@ 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.instrument=true # Instrument all available data sources.
management.metrics.jdbc.metric-name=data.source # Name of the metric for data source usage.
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.use-global-registry=true # Whether auto-configured MeterRegistry implementations should be bound to the global static registry on Metrics. management.metrics.use-global-registry=true # Whether auto-configured MeterRegistry implementations should be bound to the global static registry on Metrics.
management.metrics.web.client.max-uri-tags=100 # Maximum number of unique URI tag values allowed. After the max number of tag values is reached, metrics with additional tag values are denied by filter. management.metrics.web.client.max-uri-tags=100 # Maximum number of unique URI tag values allowed. After the max number of tag values is reached, metrics with additional tag values are denied by filter.
management.metrics.web.client.record-request-percentiles=false # Whether instrumented requests record percentiles histogram buckets by default. management.metrics.web.client.record-request-percentiles=false # Whether instrumented requests record percentiles histogram buckets by default.

@ -1243,11 +1243,9 @@ is required. A `CacheMetricsRegistrar` bean is made available to make that proce
[[production-ready-metrics-jdbc]] [[production-ready-metrics-jdbc]]
=== DataSource Metrics === DataSource Metrics
Auto-configuration enables the instrumentation of all available ``DataSource`` objects Auto-configuration enables the instrumentation of all available ``DataSource`` objects
with a metric named `data.source`. Data source instrumentation results in gauges with a metric named `jdbc`. Data source instrumentation results in gauges representing the
representing the currently active, maximum allowed, and minimum allowed connections in the currently active, maximum allowed, and minimum allowed connections in the pool. Each of
pool. Each of these gauges has a name that is prefixed by `data.source` by default. The these gauges has a name that is prefixed by `jdbc`.
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. Metrics are also tagged by the name of the `DataSource` computed based on the bean name.
@ -1256,8 +1254,7 @@ Metrics are also tagged by the name of the `DataSource` computed based on the be
[[production-ready-metrics-rabbitmq]] [[production-ready-metrics-rabbitmq]]
=== RabbitMQ metrics === RabbitMQ metrics
Auto-configuration will enable the instrumentation of all available RabbitMQ connection Auto-configuration will enable the instrumentation of all available RabbitMQ connection
factories with a metric named `rabbitmq`. The prefix can be customized by using the factories with a metric named `rabbitmq`.
`management.metrics.rabbitmq.metric-name` property.

Loading…
Cancel
Save