Skip to content

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

Open
theycallmeloki wants to merge 2 commits into
open-telemetry:mainfrom
theycallmeloki:fix/instrument-validation-message
Open

fix(sdk): correct instrument name validation error message length#5513
theycallmeloki wants to merge 2 commits into
open-telemetry:mainfrom
theycallmeloki:fix/instrument-validation-message

Conversation

@theycallmeloki

Copy link
Copy Markdown

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

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

2 participants