Skip to content

Relax instrument name validation per opentelemetry-specification#5092#7297

Closed
cijothomas wants to merge 1 commit into
open-telemetry:mainfrom
cijothomas:cijothomas/relax-instrument-name
Closed

Relax instrument name validation per opentelemetry-specification#5092#7297
cijothomas wants to merge 1 commit 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, case-insensitive identity, and the 255-character maximum are unchanged.

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

Backwards compatibility

Strict superset of the existing rule. Every name valid under the old regex remains valid; some previously-rejected names are now accepted.

@github-actions github-actions Bot added the pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package label May 14, 2026
@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 89.93%. Comparing base (b0d5e79) to head (3cddecb).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7297      +/-   ##
==========================================
+ Coverage   89.85%   89.93%   +0.07%     
==========================================
  Files         273      273              
  Lines       13773    13773              
==========================================
+ Hits        12376    12387      +11     
+ Misses       1397     1386      -11     
Flag Coverage Δ
unittests-Project-Experimental 89.74% <ø> (-0.06%) ⬇️
unittests-Project-Stable 89.81% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...lemetry/Metrics/Builder/MeterProviderBuilderSdk.cs 100.00% <ø> (ø)

... and 3 files with indirect coverage changes

@cijothomas cijothomas changed the title [draft] Relax instrument name validation per opentelemetry-specification#5092 Relax instrument name validation per opentelemetry-specification#5092 May 14, 2026
@cijothomas
Copy link
Copy Markdown
Member Author

Closing — open-telemetry/opentelemetry-specification#5092 was closed in favor of using Views for these cases (per spec clarification open-telemetry/opentelemetry-specification#5094). The Meter-level instrument name relaxation is no longer needed. The View-level fix is tracked in #7300.

@cijothomas cijothomas closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant