Skip to content

GH-3108: Document that NamingConvention only processes dot-separated names - #7602

Open
won-seoop wants to merge 1 commit into
micrometer-metrics:mainfrom
won-seoop:doc-3108-naming-convention-dot-notation
Open

GH-3108: Document that NamingConvention only processes dot-separated names#7602
won-seoop wants to merge 1 commit into
micrometer-metrics:mainfrom
won-seoop:doc-3108-naming-convention-dot-notation

Conversation

@won-seoop

Copy link
Copy Markdown

Summary

Closes #3108

The root confusion in this issue is that users expect NamingConvention.snakeCase to convert all separators (including hyphens) to underscores, but it only processes dot-separated names — which is Micrometer's canonical form.

The issue thread clarifies (from @shakuzen):

In general, we don't want to change things any more than we have to for a backend's requirements... NamingConvention.snakeCase is a general implementation not specific to any backend, and therefore it only handles converting from canonical form (dot case) to snake case.
PrometheusNamingConvention can be more specific... Prometheus doesn't allow many characters - so it is by chance that kebab case also gets converted, because - is not an allowed character.
The problem here is that NamingConvention.snakeCase should not be used with PrometheusMeterRegistry.

This PR adds a NOTE callout in the naming.adoc Tag Naming section that:

  • Explains that generic naming conventions only translate dot separators, not hyphens or other chars
  • Shows a concrete example (my-tag-name stays as my-tag-name, but my.tag.namemy_tag_name)
  • Notes that each registry ships with a backend-specific naming convention, and replacing it (e.g., Prometheus' default) with NamingConvention.snakeCase produces unexpected results

Test plan

  • ./gradlew antora generates the site and the Tag Naming section includes the new NOTE
  • Example text renders correctly

🤖 Generated with Claude Code

…ses dot-separated names

Add a NOTE to the Tag Naming section clarifying that generic naming
conventions (like NamingConvention.snakeCase) only translate dot
separators to the backend's idiomatic separator. Hyphens and other
non-dot characters are passed through verbatim.

Also note that each registry ships with its own backend-specific naming
convention (e.g. PrometheusNamingConvention) that handles disallowed
characters, and replacing it with a generic convention can cause
unexpected tag names.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document the behavior and expectations of NamingConvention

1 participant