Skip to content

[chore] Make Semantic Convention metric name character set explicit#3721

Open
cijothomas wants to merge 3 commits into
open-telemetry:mainfrom
cijothomas:cijothomas/restrict-semconv-name-charset
Open

[chore] Make Semantic Convention metric name character set explicit#3721
cijothomas wants to merge 3 commits into
open-telemetry:mainfrom
cijothomas:cijothomas/restrict-semconv-name-charset

Conversation

@cijothomas
Copy link
Copy Markdown
Member

Description

Adds a normative rule that metric instrument names defined by Semantic Conventions must match the regular expression [a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)* — lowercase ASCII alphanumerics and underscores, separated by dots into namespaces.

This is a codification of the existing convention. None of the existing semconv metric names are affected.

Why now

The OpenTelemetry Specification is considering opentelemetry-specification#5092, which expands the API-level allowed character set for user-defined instrument names. Making the semconv-side rule explicit removes any ambiguity about whether the broader API-level allowlist applies to semconv-defined metric names — it doesn't.

@cijothomas cijothomas changed the title Make Semantic Convention metric name character set explicit [chore] Make Semantic Convention metric name character set explicit May 14, 2026
@kamphaus
Copy link
Copy Markdown
Contributor

Should a rego policy enforce this?

Adds a metric_name_regex matching the rule documented in
docs/general/naming.md (^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$) and
applies it to the metric_name yaml_schema check, replacing the more
general name_regex previously used there. Tests are updated to cover
the metric-specific cases (e.g. 'foo.1bar' is rejected for metrics
even though it remains valid for attributes/events/resources).
@cijothomas cijothomas requested a review from a team as a code owner May 14, 2026 18:29
@cijothomas
Copy link
Copy Markdown
Member Author

Should a rego policy enforce this?

I made an attempt and pushed a commit - let me know if that was your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

2 participants