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

UNIT and HELP must not be present #255

Open
roidelapluie opened this issue Sep 30, 2022 · 6 comments
Open

UNIT and HELP must not be present #255

roidelapluie opened this issue Sep 30, 2022 · 6 comments

Comments

@roidelapluie
Copy link
Member

In the spec:

MetricFamily
A MetricFamily MAY have zero or more Metrics. A MetricFamily MUST have a name, HELP, TYPE, and UNIT metadata. Every Metric within a MetricFamily MUST have a unique LabelSet.

The first MUST is not correct.

In ABNF:

metricfamily = *metric-descriptor *metric

metric-descriptor = HASH SP type SP metricname SP metric-type LF
metric-descriptor =/ HASH SP help SP metricname SP escaped-string LF
metric-descriptor =/ HASH SP unit SP metricname SP *metricname-char LF
@RichiH
Copy link
Member

RichiH commented Sep 30, 2022

From my Slack with Julien just now: I believe it should be

A MetricFamily MUST have a name, and TYPE metadata. It SHOULD have HELP, and UNIT metadata.

This also aligns with what's later in the spec:

If the unit is known it SHOULD be provided.
The value of a UNIT or HELP line MAY be empty. This MUST be treated as if no metadata line for the MetricFamily existed.

@brian-brazil
Copy link
Contributor

From my Slack with Julien just now: I believe it should be

The current wording is what you argued for. The text is saying that the values must always be present, but HELP and UNIT can be empty.

@RichiH
Copy link
Member

RichiH commented Oct 1, 2022

I can't remember; may well be.

The ABNF uses =/, so the whole line is optional as ABNF takes precedence.

As of today, I am not convinced if forcing empty lines is a positive.

@brian-brazil
Copy link
Contributor

That section of the spec is about the data model, not the wire format.

We don't force empty lines.

@fstab
Copy link
Member

fstab commented Dec 7, 2022

Related:

MetricFamilies of type Info MUST have an empty Unit string.

@brian-brazil
Copy link
Contributor

Yes, that's correct as a unit is nonsensical for info. As before that line is in the data model section, not wire format.

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

No branches or pull requests

4 participants