Browse Source

Polish "Remove unnecessary config options for metrics"

Closes gh-12017"
pull/12022/merge
Stephane Nicoll 8 years ago
parent
commit
b28cabdb12
  1. 4
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java
  2. 3
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/amqp/RabbitMetricsTests.java
  3. 5
      spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
  4. 11
      spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

4
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java

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

3
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/amqp/RabbitMetricsTests.java

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

5
spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

@ -1300,7 +1300,6 @@ content into your application. Rather, pick only the properties that you need. @@ -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.processor.enabled=true # Whether to enable processor 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.*= # 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.
@ -1391,10 +1390,6 @@ content into your application. Rather, pick only the properties that you need. @@ -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.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.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.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.

11
spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

@ -1243,11 +1243,9 @@ is required. A `CacheMetricsRegistrar` bean is made available to make that proce @@ -1243,11 +1243,9 @@ is required. A `CacheMetricsRegistrar` bean is made available to make that proce
[[production-ready-metrics-jdbc]]
=== DataSource Metrics
Auto-configuration enables the instrumentation of all available ``DataSource`` objects
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.metric-name`
property.
with a metric named `jdbc`. 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 `jdbc`.
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 @@ -1256,8 +1254,7 @@ Metrics are also tagged by the name of the `DataSource` computed based on the be
[[production-ready-metrics-rabbitmq]]
=== RabbitMQ metrics
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
`management.metrics.rabbitmq.metric-name` property.
factories with a metric named `rabbitmq`.

Loading…
Cancel
Save