Skip to content

feat(sdk): relax instrument name validation; remove experimental_metrics_disable_name_validation feature#3517

Draft
cijothomas wants to merge 2 commits into
open-telemetry:mainfrom
cijothomas:cijothomas/relax-instrument-name
Draft

feat(sdk): relax instrument name validation; remove experimental_metrics_disable_name_validation feature#3517
cijothomas wants to merge 2 commits into
open-telemetry:mainfrom
cijothomas:cijothomas/relax-instrument-name

Conversation

@cijothomas
Copy link
Copy Markdown
Member

Draft — depends on opentelemetry-specification#5092. Will be ready for review once the spec PR is merged.

Description

Relaxes the SDK instrument-name validation to match the proposed expanded character set in opentelemetry-specification#5092:

  • Adds :, \, (, ), %, *, #, and space to the allowed character set.
  • Drops the requirement that the first character be alphabetic.
  • Space is restricted to non-leading and non-trailing positions.
  • ASCII-only, the 255-byte maximum, and the name must be non-empty rule are unchanged.

This enables Windows performance counter style names (e.g. \Processor(_Total)\% Processor Time, \.NET CLR Memory(*)\# Bytes in all Heaps) to be used directly as instrument names without workarounds.

Removes the experimental_metrics_disable_name_validation Cargo feature (introduced in #2538 specifically for these use cases). With the relaxed validation, the workaround is no longer needed and the feature can be retired.

Backwards compatibility

Strict superset of the existing rule. Every name valid under the old validator remains valid; some previously-rejected names are now accepted. Consumers that enabled experimental_metrics_disable_name_validation should drop the feature from their Cargo.toml.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.0%. Comparing base (8db5a12) to head (038a322).

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3517     +/-   ##
=======================================
+ Coverage   82.8%   83.0%   +0.1%     
=======================================
  Files        130     130             
  Lines      27289   27362     +73     
=======================================
+ Hits       22622   22726    +104     
+ Misses      4667    4636     -31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cijothomas cijothomas changed the title [draft] Relax instrument name validation; remove experimental_metrics_disable_name_validation feature feat(sdk): relax instrument name validation; remove experimental_metrics_disable_name_validation feature May 14, 2026
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.

1 participant