Skip to content

fix(sdk): correct instrument name validation error message length - #5513

Merged
aabmass merged 5 commits into
open-telemetry:mainfrom
theycallmeloki:fix/instrument-validation-message
Aug 13, 2026
Merged

fix(sdk): correct instrument name validation error message length#5513
aabmass merged 5 commits into
open-telemetry:mainfrom
theycallmeloki:fix/instrument-validation-message

Conversation

@theycallmeloki

Copy link
Copy Markdown
Contributor

fix(sdk): correct instrument name validation error message length

Fixes #5284

Both instrument name and unit validation failures raised the same message:
"Expected ASCII string of maximum length 63 characters but got {}". Per the
spec, names allow up to 255 characters (plus start-letter/character-set
rules), while units are limited to 63. The misleading message sent developers
debugging length when the real problem was an invalid character.

  • _ERROR_MESSAGE split into _NAME_ERROR_MESSAGE (255) and
    _UNIT_ERROR_MESSAGE (63), applied at all four raise sites (sync + async
    instruments).
  • Added TestInstrumentValidationMessages covering both messages.

Note: two commenters expressed interest in this issue without opening a PR;
happy to coordinate if they're actively working on something related.

Signed-off-by: Loki San <ogmiladyloki@gmail.com>
@github-project-automation github-project-automation Bot moved this from Ready for review to Approved PRs in Python PR digest Aug 11, 2026
@aabmass

aabmass commented Aug 13, 2026

Copy link
Copy Markdown
Member

Thanks!

@aabmass
aabmass added this pull request to the merge queue Aug 13, 2026
@aabmass aabmass moved this from Approved PRs to Ready for merge in Python PR digest Aug 13, 2026
Merged via the queue into open-telemetry:main with commit d0ea656 Aug 13, 2026
1150 of 1154 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for merge to Done in Python PR digest Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Misleading error message for instrument name validation (shows unit length 63)

3 participants