Search code examples
javaspring-bootmetricsspring-boot-actuatorapplication.properties

Spring boot management.metrics.distribution exception


I'm trying to set the values of these two properties in my spring boot application.properties file -

management.metrics.distribution.maximum-expected-value=1
management.metrics.distribution.maximum-expected-value=10

or

management.metrics.distribution.maximum-expected-value=1s
management.metrics.distribution.maximum-expected-value=10s

Every-time I try to run my application with these two fields set, I get below exception -

APPLICATION FAILED TO START\n***************************\n\nDescription:\n\nFailed to bind properties under 'management.metrics.distribution.maximum-expected-value' to java.util.Map<java.lang.String, java.lang.String>:\n\n Reason: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]\n\nAction:\n\nUpdate your application's configuration\n"}

I'm going through the doc, but they don't have shown any example how to set those values properly - https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1.0-RC1-Configuration-Changelog#:~:text=management.metrics.distribution,minimum%2Dexpected%2Dvalue

Can anyone please tell me what I'm doing wrong here?


Solution

  • Those properties are for configuring per-meter maximums and you haven't include a meter name. For example, to configure a maximum of 10s for meter names starting with example.meter, you would configure management.metrics.distribution.maximum-expected-value.example.meter=10s.

    The reference documentation contains a section on per-meter properties.