prometheus / client_golang

Prometheus instrumentation library for Go applications
https://pkg.go.dev/github.com/prometheus/client_golang
Apache License 2.0
5.4k stars 1.18k forks source link

Don't output HELP comments when empty #620

Closed peterfajdiga closed 5 years ago

peterfajdiga commented 5 years ago

common/text_create.go is designed to not output the Help comment if MetricFamily.Help is nil: https://github.com/prometheus/common/blob/master/expfmt/text_create.go#L98

I don't, however, see a way to set it to nil in client_golang. Desc.help can only hold an empty string, but that still results in the Help comment being outputted.

Behavior observed in version v1.0.0

beorn7 commented 5 years ago

That's in line with https://prometheus.io/docs/instrumenting/writing_clientlibs/#metric-description-and-help .

In short: Help strings are mandatory. The exposition format tolerates if they are missing, but the client libraries enforce a help string – with the concession that the string might have length zero.

peterfajdiga commented 5 years ago

That explains it. Thanks for the reply and sorry for opening this non-issue.