Skip to content

Commit b28cabd

Browse files
committed
Polish "Remove unnecessary config options for metrics"
Closes gh-12017"
1 parent 49f21a2 commit b28cabd

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ private <N extends Number> void bindPoolMetadata(MeterRegistry registry, String
8080
bindDataSource(registry, metricName, this.metadataProvider.getValueFunction(function));
8181
}
8282

83-
private <N extends Number> void bindDataSource(MeterRegistry registry, String metricName,
84-
Function<DataSource, N> function) {
83+
private <N extends Number> void bindDataSource(MeterRegistry registry,
84+
String metricName, Function<DataSource, N> function) {
8585
if (function.apply(this.dataSource) != null) {
8686
registry.gauge("jdbc." + metricName + ".connections", this.tags,
8787
this.dataSource, (m) -> function.apply(m).doubleValue());

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public void connectionFactoryWithTagsIsInstrumented() {
4747
.bindTo(registry);
4848
assertThat(registry.get("rabbitmq.connections").tags("env", "prod").meter())
4949
.isNotNull();
50-
assertThat(registry.find("rabbitmq.connections").tags("env", "dev").meter()).isNull();
50+
assertThat(registry.find("rabbitmq.connections").tags("env", "dev").meter())
51+
.isNull();
5152
}
5253

5354
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,6 @@ content into your application. Rather, pick only the properties that you need.
13001300
management.metrics.binders.logback.enabled=true # Whether to enable Logback metrics.
13011301
management.metrics.binders.processor.enabled=true # Whether to enable processor metrics.
13021302
management.metrics.binders.uptime.enabled=true # Whether to enable uptime metrics.
1303-
management.metrics.cache.instrument=true # Instrument all available caches.
13041303
management.metrics.distribution.percentiles-histogram.*= # Whether meter IDs starting-with the specified name should be publish percentile histograms.
13051304
management.metrics.distribution.percentiles.*= # Specific computed non-aggregable percentiles to ship to the backend for meter IDs starting-with the specified name.
13061305
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.
13911390
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.
13921391
management.metrics.export.statsd.port=8125 # Port of the StatsD server to receive exported metrics.
13931392
management.metrics.export.statsd.queue-size=2147483647 # Maximum size of the queue of items waiting to be sent to the StatsD server.
1394-
management.metrics.jdbc.instrument=true # Instrument all available data sources.
1395-
management.metrics.jdbc.metric-name=data.source # Name of the metric for data source usage.
1396-
management.metrics.rabbitmq.instrument=true # Instrument all available connection factories.
1397-
management.metrics.rabbitmq.metric-name=rabbitmq # Name of the metric for RabbitMQ usage.
13981393
management.metrics.use-global-registry=true # Whether auto-configured MeterRegistry implementations should be bound to the global static registry on Metrics.
13991394
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.
14001395
management.metrics.web.client.record-request-percentiles=false # Whether instrumented requests record percentiles histogram buckets by default.

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,11 +1243,9 @@ is required. A `CacheMetricsRegistrar` bean is made available to make that proce
12431243
[[production-ready-metrics-jdbc]]
12441244
=== DataSource Metrics
12451245
Auto-configuration enables the instrumentation of all available ``DataSource`` objects
1246-
with a metric named `data.source`. Data source instrumentation results in gauges
1247-
representing the currently active, maximum allowed, and minimum allowed connections in the
1248-
pool. Each of these gauges has a name that is prefixed by `data.source` by default. The
1249-
prefix can be customized by setting the `management.metrics.jdbc.metric-name`
1250-
property.
1246+
with a metric named `jdbc`. Data source instrumentation results in gauges representing the
1247+
currently active, maximum allowed, and minimum allowed connections in the pool. Each of
1248+
these gauges has a name that is prefixed by `jdbc`.
12511249

12521250
Metrics are also tagged by the name of the `DataSource` computed based on the bean name.
12531251

@@ -1256,8 +1254,7 @@ Metrics are also tagged by the name of the `DataSource` computed based on the be
12561254
[[production-ready-metrics-rabbitmq]]
12571255
=== RabbitMQ metrics
12581256
Auto-configuration will enable the instrumentation of all available RabbitMQ connection
1259-
factories with a metric named `rabbitmq`. The prefix can be customized by using the
1260-
`management.metrics.rabbitmq.metric-name` property.
1257+
factories with a metric named `rabbitmq`.
12611258

12621259

12631260

0 commit comments

Comments
 (0)