Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put metric before label value in the "label value too long" error mes… #4018

Merged
merged 3 commits into from
Mar 30, 2021

Conversation

ChinYing-Li
Copy link
Contributor

…sage (#1582)

Signed-off-by: ChinYing-Li [email protected]

What this PR does:
This PR is #3982 applied to d45e65ad1e90d22dbdbe224f6eb4036847b56c82.
Swap the position of the metric string and the label value string in error message of labelValueTooLong.
Now the metric string is placed before the label value string.

Which issue(s) this PR fixes:
Fixes #1582

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Thank you!

return &genericValidationError{
message: "label value too long: %.200q metric %.200q",
return &labelValueTooLongError{
message: "label value too long for metric: %.200q name %.200q",
Copy link
Contributor

@pstibrany pstibrany Mar 27, 2021

Choose a reason for hiding this comment

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

I'd suggest to remove message field in labelValueTooLongError completely, and put this message into (*labelValueTooLongError).Error() method (fmt.Sprintf call), so that the message and correct order of parameters are together.

@pracucci
Copy link
Contributor

@ChinYing-Li Could you fix the linter, please?

}

func (e *labelValueTooLongError) Error() string {
return fmt.Sprintf("label value too long for metric: %.200q label valu%.200q", formatLabelSet(e.series), e.cause)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Sprintf("label value too long for metric: %.200q label valu%.200q", formatLabelSet(e.series), e.cause)
return fmt.Sprintf("label value too long for metric: %.200q label value: %.200q", formatLabelSet(e.series), e.cause)

@ChinYing-Li
Copy link
Contributor Author

Sorry about the problem with linting! Just fixed that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error message for 'label value too long' misses important information
3 participants