Micrometer recommends that metric and tag names are lower-case and dot-separated. We should review our default metrics and tags to identify those that do not comply with the recommendations. Once we know how many non-compliant names we’re dealing with, we can consider how and when to change them.

Tentatively scheduling for 2.7 but this may get pushed back.

Comment From: wilkinsona

The following are non-compliant tag names:

https://github.com/spring-projects/spring-boot/blob/ef79a18514ba004552f7aab88183b79133f724de/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsRegistrarConfiguration.java#L75

https://github.com/spring-projects/spring-boot/blob/ef79a18514ba004552f7aab88183b79133f724de/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/graphql/GraphQlTags.java#L44

https://github.com/spring-projects/spring-boot/blob/ef79a18514ba004552f7aab88183b79133f724de/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/graphql/GraphQlTags.java#L62

https://github.com/spring-projects/spring-boot/blob/ef79a18514ba004552f7aab88183b79133f724de/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/graphql/GraphQlTags.java#L83

https://github.com/spring-projects/spring-boot/blob/ef79a18514ba004552f7aab88183b79133f724de/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java#L118

https://github.com/spring-projects/spring-boot/blob/ef79a18514ba004552f7aab88183b79133f724de/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java#L48

https://github.com/spring-projects/spring-boot/blob/ef79a18514ba004552f7aab88183b79133f724de/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java#L109

https://github.com/spring-projects/spring-boot/blob/ef79a18514ba004552f7aab88183b79133f724de/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/startup/StartupTimeMetricsListener.java#L126

I haven't found any non-compliant metric names.

The three GraphQL-related tags are all new in 2.7 so those can be changed without much further thought. The others were added in 2.6 or earlier so renaming them may have an impact on production dashboards. There are a few different options available to us:

  • Rename them and add an entry to the release notes describing how to implement MeterFilter and map(Id) to restore the old names if necessary
  • Add an equivalent lower-case dot-separated tag alongside the current tag in 2.7 (or even a maintenance release) to provide a migration period before removing the non-compliant tags in 3.0
  • Leave them as-is and recommend the use of MeterFilter and map(Id) to change them if necessary

I'm going to ask the Observability team for some advice on how best to handle this.

Comment From: checketts

Camelcase seems fine. I think the problem with hyphens is they can be interpreted as subtraction in some contexts (like a promql query).

Comment From: wilkinsona

From @shakuzen:

We have some in Micrometer instrumentation we need to consider what to do with ourselves. Sorry we didn't find these and discuss earlier. We'll discuss internally to come up with general guidance on this and plan to document it better. It's not entirely a problem what Boot has now, though. Metric names tend to have a hierarchy to them that is separated, so it is important there. Tag names on metrics tend to have less firm convention in metrics backends and less/no hierarchy to them.

From @jonatan-ivanov:

As @checketts pointed out, camelCase should be ok. It won’t be handled as separated words but it should not break anything. So you can leave them as-is if you want to narrow the scope and only fix main-application-class.

I might be a little draconian here but I would go with the first option: making the change and describe the way to restore the old value using a MeterFilter.

Comment From: wilkinsona

We're going to change all the incompatible tag names to the recommended lower.case format in 2.7.