prometheus / docs

Prometheus documentation: content and static site generator
https://prometheus.io
Apache License 2.0
659 stars 1.01k forks source link

Need clarification of docs/instrumenting/exposition_formats.md, is it missing information? #1779

Open fieldju opened 3 years ago

fieldju commented 3 years ago
# HELP foo_total  
# TYPE foo_total counter
foo_total{hostname="localhost",optionalExtraMetadata="my-cool-value",} 1.0
# HELP foo_total  
# TYPE foo_total counter
foo_total{hostname="localhost",} 1.0

:point_up: is this valid as of v0.4.0? I wrote an integration test that proves it is, but there is some debate on whether that's to spec or not.

Reading through https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md

I am not seeing any reference to

A given metric name MAY NOT repeat if the cardinality of the label-value pairs between its instances varies.

From this section

image

of the legacy Client Data Exposition Format document.

Does this mean as of the current spec you can have the same metric more than once with varying labels?

Would be nice to add this info to the current doc.

brian-brazil commented 3 years ago

This is not valid exposition, as you're repeating the HELP/TYPE and will be rejected by the reference parser in https://github.com/prometheus/common/tree/master/expfmt

Per the doc "Only one TYPE line may exist for a given metric name. ", and similarly for HELP.