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

Detect invalid Descs in const metrics, but also allow empty Help strings. #460

Merged
merged 2 commits into from
Sep 17, 2018

Conversation

beorn7
Copy link
Member

@beorn7 beorn7 commented Sep 17, 2018

beorn7 added 2 commits September 17, 2018 11:50
The error of the invalid Desc is returned in that case.

Signed-off-by: beorn7 <beorn@soundcloud.com>
This is in line with
https://prometheus.io/docs/instrumenting/writing_clientlibs/#metric-description-and-help

Since the zero value of a string in Go is `""`, we cannot distinguish
between a Help string not set and an empty Help string. Thus, we just
make it formally optional here with an encouragement to set it in the
doc comment.

In v0.10, the Help string will probably become a "normal" argument of
the constructor rather than a field in an Opts struct.

Signed-off-by: beorn7 <beorn@soundcloud.com>
@carlpett
Copy link
Member

LGTM 👍
Thanks for fast fix!

@beorn7 beorn7 merged commit e637cec into master Sep 17, 2018
@beorn7 beorn7 deleted the beorn7/desc branch September 17, 2018 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants