Skip to content

Fix error messages in label and exemplar validation - #1236

Merged
csmarchbanks merged 1 commit into
prometheus:masterfrom
caiotheodoro:fix-validation-error-messages
Oct 30, 2026
Merged

csmarchbanks merged 1 commit into
prometheus:masterfrom
caiotheodoro:fix-validation-error-messages

Conversation

@caiotheodoro

Copy link
Copy Markdown
Contributor

_validate_exemplar raises Exemplar labels have %d UTF-8 characters, exceeding the limit of 128 without ever filling in the placeholder, so Counter('c', 'h').inc(exemplar={'a': 'x' * 129}) reports a literal %d. It now reports the count.

_validate_labelnames raises Reserved label methe fric name: le for Histogram(..., labelnames=['le']) and Summary(..., labelnames=['quantile']). The typo came in with #1070; before that it read Reserved label metric name. Restored.

The four affected tests now assert on the message and fail on the old source. Full suite: 428 passed, 14 skipped.

@csmarchbanks

Drafted with Claude Sonnet 5.5. Reviewed by Muse Spark 1.3 and GLM 5.3 as judges before submission.

The exemplar length error never interpolated its %d placeholder, and the reserved label error read "Reserved label methe fric name" since prometheus#1070.

Signed-off-by: Caio Theodoro <48462974+caiotheodoro@users.noreply.github.com>
@caiotheodoro

Copy link
Copy Markdown
Contributor Author

Could a maintainer take a look at this? The main decision is the wording for the reserved-label error. I restored Reserved label metric name from before #1070, but I can change it if you'd prefer different text.

@csmarchbanks csmarchbanks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@csmarchbanks
csmarchbanks merged commit a6b04c5 into prometheus:master Oct 30, 2026
2 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants