mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-08 10:19:13 +00:00
Previously, a whole number string would be parsed into a Duration. Duration values are ignored for distribution summary meters which results in unexpected values when configuring minimum and maximum expected values and SLO boundaries. Strings like 20d are ambiguous as they can be either a duration of 20 days or a double of 20. To preserve existing behavior where 20d was interpreted as a 20-day duration, strings that contain only digits are parsed into a double which is ultimately treated as a number of milliseconds, the same unit as if it had been parsed into a Duration. Otherwise we fall back to the existing behavior of trying a Duration and then falling back to parsing a double. Note that negative values do not need to be considered. As per their javadoc, DistributionSummary and Timer implementations drop negative amounts passed to record. As a result, negative values for min and max expected values and SLO boundaries do not make sense. Fixes gh-50021