From 08251b26d0d977aa09908f79dec3a023baf77f05 Mon Sep 17 00:00:00 2001 From: bono007 Date: Tue, 24 Aug 2021 21:53:57 -0500 Subject: [PATCH 1/2] Add support for configuring the path of disk space metrics See gh-27660 --- .../metrics/MetricsProperties.java | 37 +++++++++ .../SystemMetricsAutoConfiguration.java | 18 +++-- .../SystemMetricsAutoConfigurationTests.java | 37 +++++++-- .../system/DiskSpaceMetricsBinder.java | 52 ++++++++++++ .../actuate/metrics/system/package-info.java | 20 +++++ .../system/DiskSpaceMetricsBinderTests.java | 79 +++++++++++++++++++ 6 files changed, 231 insertions(+), 12 deletions(-) create mode 100644 spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java create mode 100644 spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/package-info.java create mode 100644 spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinderTests.java diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java index 61583ff424..d23a0277a4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java @@ -16,8 +16,11 @@ package org.springframework.boot.actuate.autoconfigure.metrics; +import java.io.File; import java.time.Duration; +import java.util.Arrays; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -30,6 +33,7 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty; * @author Jon Schneider * @author Alexander Abramov * @author Tadaya Tsuyukubo + * @author Chris Bono * @since 2.0.0 */ @ConfigurationProperties("management.metrics") @@ -57,6 +61,8 @@ public class MetricsProperties { private final Data data = new Data(); + private final System system = new System(); + private final Distribution distribution = new Distribution(); public boolean isUseGlobalRegistry() { @@ -87,6 +93,10 @@ public class MetricsProperties { return this.distribution; } + public System getSystem() { + return this.system; + } + public static class Web { private final Client client = new Client(); @@ -342,4 +352,31 @@ public class MetricsProperties { } + public static class System { + + private final Diskspace diskspace = new Diskspace(); + + public Diskspace getDiskspace() { + return this.diskspace; + } + + public static class Diskspace { + + /** + * Comma-separated list of paths to report disk metrics for. + */ + private List paths = Arrays.asList(new File(".")); + + public List getPaths() { + return this.paths; + } + + public void setPaths(List paths) { + this.paths = paths; + } + + } + + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java index dd784698fc..ff92d35032 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 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. @@ -16,14 +16,13 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import java.io.File; - import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.binder.system.DiskSpaceMetrics; +import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.binder.system.FileDescriptorMetrics; import io.micrometer.core.instrument.binder.system.ProcessorMetrics; import io.micrometer.core.instrument.binder.system.UptimeMetrics; +import org.springframework.boot.actuate.metrics.system.DiskSpaceMetricsBinder; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; @@ -36,6 +35,7 @@ import org.springframework.context.annotation.Configuration; * {@link EnableAutoConfiguration Auto-configuration} for system metrics. * * @author Stephane Nicoll + * @author Chris Bono * @since 2.1.0 */ @Configuration(proxyBeanMethods = false) @@ -44,6 +44,12 @@ import org.springframework.context.annotation.Configuration; @ConditionalOnBean(MeterRegistry.class) public class SystemMetricsAutoConfiguration { + private final MetricsProperties properties; + + public SystemMetricsAutoConfiguration(MetricsProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean public UptimeMetrics uptimeMetrics() { @@ -64,8 +70,8 @@ public class SystemMetricsAutoConfiguration { @Bean @ConditionalOnMissingBean - public DiskSpaceMetrics diskSpaceMetrics() { - return new DiskSpaceMetrics(new File(".")); + public DiskSpaceMetricsBinder diskSpaceMetrics() { + return new DiskSpaceMetricsBinder(this.properties.getSystem().getDiskspace().getPaths(), Tags.empty()); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfigurationTests.java index 7b34bd3c1a..93f705df76 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2021 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. @@ -17,14 +17,17 @@ package org.springframework.boot.actuate.autoconfigure.metrics; import java.io.File; +import java.util.Arrays; +import java.util.Collections; -import io.micrometer.core.instrument.binder.system.DiskSpaceMetrics; +import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.binder.system.FileDescriptorMetrics; import io.micrometer.core.instrument.binder.system.ProcessorMetrics; import io.micrometer.core.instrument.binder.system.UptimeMetrics; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun; +import org.springframework.boot.actuate.metrics.system.DiskSpaceMetricsBinder; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; @@ -81,16 +84,37 @@ class SystemMetricsAutoConfigurationTests { @Test void autoConfiguresDiskSpaceMetrics() { - this.contextRunner.run((context) -> assertThat(context).hasSingleBean(DiskSpaceMetrics.class)); + this.contextRunner.run((context) -> assertThat(context).hasSingleBean(DiskSpaceMetricsBinder.class)); } @Test void allowsCustomDiskSpaceMetricsToBeUsed() { this.contextRunner.withUserConfiguration(CustomDiskSpaceMetricsConfiguration.class) - .run((context) -> assertThat(context).hasSingleBean(DiskSpaceMetrics.class) + .run((context) -> assertThat(context).hasSingleBean(DiskSpaceMetricsBinder.class) .hasBean("customDiskSpaceMetrics")); } + @Test + void diskSpaceMetricsUsesDefaultPath() { + this.contextRunner + .run((context) -> assertThat(context).hasBean("diskSpaceMetrics").getBean(DiskSpaceMetricsBinder.class) + .hasFieldOrPropertyWithValue("paths", Collections.singletonList(new File(".")))); + } + + @Test + void allowsDiskSpaceMetricsPathToBeConfiguredWithSinglePath() { + this.contextRunner.withPropertyValues("management.metrics.system.diskspace.paths:..") + .run((context) -> assertThat(context).hasBean("diskSpaceMetrics").getBean(DiskSpaceMetricsBinder.class) + .hasFieldOrPropertyWithValue("paths", Collections.singletonList(new File("..")))); + } + + @Test + void allowsDiskSpaceMetricsPathToBeConfiguredWithMultiplePaths() { + this.contextRunner.withPropertyValues("management.metrics.system.diskspace.paths:.,..") + .run((context) -> assertThat(context).hasBean("diskSpaceMetrics").getBean(DiskSpaceMetricsBinder.class) + .hasFieldOrPropertyWithValue("paths", Arrays.asList(new File("."), new File("..")))); + } + @Configuration(proxyBeanMethods = false) static class CustomUptimeMetricsConfiguration { @@ -125,8 +149,9 @@ class SystemMetricsAutoConfigurationTests { static class CustomDiskSpaceMetricsConfiguration { @Bean - DiskSpaceMetrics customDiskSpaceMetrics() { - return new DiskSpaceMetrics(new File(System.getProperty("user.dir"))); + DiskSpaceMetricsBinder customDiskSpaceMetrics() { + return new DiskSpaceMetricsBinder(Collections.singletonList(new File(System.getProperty("user.dir"))), + Tags.empty()); } } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java new file mode 100644 index 0000000000..d06e5b0b0d --- /dev/null +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java @@ -0,0 +1,52 @@ +/* + * Copyright 2012-2021 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.actuate.metrics.system; + +import java.io.File; +import java.util.List; + +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.jvm.DiskSpaceMetrics; + +import org.springframework.util.Assert; + +/** + * A {@link MeterBinder} that binds one or more {@link DiskSpaceMetrics}. + * + * @author Chris Bono + * @since 2.6.0 + */ +public class DiskSpaceMetricsBinder implements MeterBinder { + + private final List paths; + + private final Iterable tags; + + public DiskSpaceMetricsBinder(List paths, Iterable tags) { + Assert.notEmpty(paths, "Paths must not be empty"); + this.paths = paths; + this.tags = tags; + } + + @Override + public void bindTo(MeterRegistry registry) { + this.paths.forEach((path) -> new DiskSpaceMetrics(path, this.tags).bindTo(registry)); + } + +} diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/package-info.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/package-info.java new file mode 100644 index 0000000000..c20815badf --- /dev/null +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2021 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Actuator support for system metrics. + */ +package org.springframework.boot.actuate.metrics.system; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinderTests.java new file mode 100644 index 0000000000..e665c7a0b4 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinderTests.java @@ -0,0 +1,79 @@ +/* + * Copyright 2012-2021 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.actuate.metrics.system; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; + +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tags; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Tests for {@link DiskSpaceMetricsBinder}. + * + * @author Chris Bono + */ +class DiskSpaceMetricsBinderTests { + + @Test + void diskSpaceMetricsWithSinglePath() { + MeterRegistry meterRegistry = new SimpleMeterRegistry(); + File path = new File("."); + DiskSpaceMetricsBinder metricsBinder = new DiskSpaceMetricsBinder(Collections.singletonList(path), + Tags.empty()); + metricsBinder.bindTo(meterRegistry); + + Tags tags = Tags.of("path", path.getAbsolutePath()); + assertThat(meterRegistry.get("disk.free").tags(tags).gauge()).isNotNull(); + assertThat(meterRegistry.get("disk.total").tags(tags).gauge()).isNotNull(); + } + + @Test + void diskSpaceMetricsWithMultiplePaths() { + MeterRegistry meterRegistry = new SimpleMeterRegistry(); + File path1 = new File("."); + File path2 = new File(".."); + DiskSpaceMetricsBinder metricsBinder = new DiskSpaceMetricsBinder(Arrays.asList(path1, path2), Tags.empty()); + metricsBinder.bindTo(meterRegistry); + + Tags tags = Tags.of("path", path1.getAbsolutePath()); + assertThat(meterRegistry.get("disk.free").tags(tags).gauge()).isNotNull(); + assertThat(meterRegistry.get("disk.total").tags(tags).gauge()).isNotNull(); + tags = Tags.of("path", path2.getAbsolutePath()); + assertThat(meterRegistry.get("disk.free").tags(tags).gauge()).isNotNull(); + assertThat(meterRegistry.get("disk.total").tags(tags).gauge()).isNotNull(); + } + + @Test + void diskSpaceMetricsWithCustomTags() { + MeterRegistry meterRegistry = new SimpleMeterRegistry(); + File path = new File("."); + Tags customTags = Tags.of("foo", "bar"); + DiskSpaceMetricsBinder metricsBinder = new DiskSpaceMetricsBinder(Collections.singletonList(path), customTags); + metricsBinder.bindTo(meterRegistry); + + Tags tags = Tags.of("path", path.getAbsolutePath(), "foo", "bar"); + assertThat(meterRegistry.get("disk.free").tags(tags).gauge()).isNotNull(); + assertThat(meterRegistry.get("disk.total").tags(tags).gauge()).isNotNull(); + } + +} From b626adf1ee35133289bfca0d6e3d057b6de4803e Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 16 Sep 2021 07:36:31 +0200 Subject: [PATCH 2/2] Polish "Add support for configuring the path of disk space metrics" See gh-27660 --- .../metrics/MetricsProperties.java | 65 ++++++++++--------- .../SystemMetricsAutoConfiguration.java | 16 ++--- ...itional-spring-configuration-metadata.json | 7 ++ .../system/DiskSpaceMetricsBinder.java | 2 +- 4 files changed, 49 insertions(+), 41 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java index d23a0277a4..b93ff7a0fc 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java @@ -18,7 +18,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics; import java.io.File; import java.time.Duration; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -89,14 +90,14 @@ public class MetricsProperties { return this.data; } - public Distribution getDistribution() { - return this.distribution; - } - public System getSystem() { return this.system; } + public Distribution getDistribution() { + return this.distribution; + } + public static class Web { private final Client client = new Client(); @@ -267,6 +268,33 @@ public class MetricsProperties { } + public static class System { + + private final Diskspace diskspace = new Diskspace(); + + public Diskspace getDiskspace() { + return this.diskspace; + } + + public static class Diskspace { + + /** + * Comma-separated list of paths to report disk metrics for. + */ + private List paths = new ArrayList<>(Collections.singletonList(new File("."))); + + public List getPaths() { + return this.paths; + } + + public void setPaths(List paths) { + this.paths = paths; + } + + } + + } + public static class Distribution { /** @@ -352,31 +380,4 @@ public class MetricsProperties { } - public static class System { - - private final Diskspace diskspace = new Diskspace(); - - public Diskspace getDiskspace() { - return this.diskspace; - } - - public static class Diskspace { - - /** - * Comma-separated list of paths to report disk metrics for. - */ - private List paths = Arrays.asList(new File(".")); - - public List getPaths() { - return this.paths; - } - - public void setPaths(List paths) { - this.paths = paths; - } - - } - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java index ff92d35032..50b0ef9769 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java @@ -16,6 +16,9 @@ package org.springframework.boot.actuate.autoconfigure.metrics; +import java.io.File; +import java.util.List; + import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.binder.system.FileDescriptorMetrics; @@ -28,6 +31,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -42,14 +46,9 @@ import org.springframework.context.annotation.Configuration; @AutoConfigureAfter({ MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class }) @ConditionalOnClass(MeterRegistry.class) @ConditionalOnBean(MeterRegistry.class) +@EnableConfigurationProperties(MetricsProperties.class) public class SystemMetricsAutoConfiguration { - private final MetricsProperties properties; - - public SystemMetricsAutoConfiguration(MetricsProperties properties) { - this.properties = properties; - } - @Bean @ConditionalOnMissingBean public UptimeMetrics uptimeMetrics() { @@ -70,8 +69,9 @@ public class SystemMetricsAutoConfiguration { @Bean @ConditionalOnMissingBean - public DiskSpaceMetricsBinder diskSpaceMetrics() { - return new DiskSpaceMetricsBinder(this.properties.getSystem().getDiskspace().getPaths(), Tags.empty()); + public DiskSpaceMetricsBinder diskSpaceMetrics(MetricsProperties properties) { + List paths = properties.getSystem().getDiskspace().getPaths(); + return new DiskSpaceMetricsBinder(paths, Tags.empty()); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index a226935654..c101f7c12c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -326,6 +326,13 @@ "reason": "Instead, filter 'process.uptime' and 'process.start.time' metrics." } }, + { + "name": "management.metrics.system.diskspace.paths", + "type": "java.util.List", + "defaultValue": [ + "." + ] + }, { "name": "management.metrics.export.appoptics.num-threads", "type": "java.lang.Integer", diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java index d06e5b0b0d..d6518b2716 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java @@ -22,7 +22,7 @@ import java.util.List; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; -import io.micrometer.core.instrument.binder.jvm.DiskSpaceMetrics; +import io.micrometer.core.instrument.binder.system.DiskSpaceMetrics; import org.springframework.util.Assert;