-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
I am bit surprised but I couldn't find any special rule for those suffixes in the ABNF to change... also tests passes despite me adding suffixes to MF names. Something smells like ABNF is too relaxed.
@ArthurSens
ArthurSens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could review only half of the PR 😬, I have some small comments
ywwg
commented
Feb 9, 2026
do we still intend to merge this?
11a31fa to
ff36b8d
Compare
bwplotka
commented
Feb 10, 2026
I think so. Much simpler now with Composite Types merged in.
bwplotka
commented
Feb 10, 2026
PTAL @krajorama @dashpole @ywwg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: Broken link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to put it is that gauges, counters, stateset names MUST NOT end with _count, _sum, _gcount, _gsum, _bucket - kind of simple rule. Would that be more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just simplify further:
MetricFamily name MUST NOT end with _count, _sum, _gcount, _gsum, _bucket.
It's true for anything except Histograms and Gauge Histograms , including Summary since that has series without magic suffixes. But I don't think it's worth making an exception for Histograms, Gauge Histograms. Especially because I don't think people will actually follow this unless SDKs prohibit it and I think we need to add a line about ingestors:
Ingestors MAY accept non compliant MetricFamily names and only error out when a naming clash occurs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally good point, but especially _count might be common as a standalone gauge or even counter. This line would prohibit for compatibility reason (so tmp time) and actually is not needed if the same target does NOT expose <metric without _count_but_histogram>.
Ingestors MAY accept non compliant MetricFamily names and only error out when a naming clash occurs.
Again, if this needs to be stronger that we need to move MetricFamily name MUST NOT end with _count, _sum, _gcount, _gsum, _bucket. to SHOULD NOT.
Every "must" MAY be accepted by some implementations, no?
I proposed SHOULD NOT for wide rule, and MUST NOT for collision explanation - framed as "OpenMetrics 2 converted to OpenMetrics 1 or Prom TEXT should not cause collisions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with SHOULD NOT. MUST NOT presumably means that we place more of a burden on clients exposing the metrics to ensure it doesn't happen (like suffixes in OM 1.0). We either would fail scrapes with bad suffixes, or we would have to "fix" names by modifying them to make them valid (which we sometimes did for OM 1.0).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just simplify further:
MetricFamily name MUST NOT end with _count, _sum, _gcount, _gsum, _bucket.
It's true for anything except Histograms and Gauge Histograms , including Summary since that has series without magic suffixes. But I don't think it's worth making an exception for Histograms, Gauge Histograms. Especially because I don't think people will actually follow this unless SDKs prohibit it and I think we need to add a line about ingestors:
Ingestors MAY accept non compliant MetricFamily names and only error out when a naming clash occurs.
Fixes prometheus/OpenMetrics#305 Signed-off-by: bwplotka <bwplotka@gmail.com>
ff36b8d to
70aa8d3
Compare
Signed-off-by: bwplotka <bwplotka@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From WG:
- Let's have other guidance for naming conventions (snake_case, unit) (TODO)
- What if exposer has this metric, what should be done? We need consistent logic for violating MUST NOT. Implementations are used to be relaxing. TODO research failure modes for violating various MUST NOT rules? e.g. server side will reject this. We don't want to put burden on clients. SDK blocking.
- General usability generic protocol vs e2e Prometheus experience?
- Collision move to should not and be around naming?
- Stronger case than just naming suffix.
- leaning into "SHOULD NOT and explain ingestors/Prometheus will likely reject such scrape for foreseeable future (for this case)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming SHOULD NOT for the suffixes
MUST NOT conflict
To ensure that the user doesn't run into this, the SDK must validate. We don't do this now, so introducing the check is technically breaking (you can register foo_total gauge and foo counter).
SDKs already check for some collisions (go, java.
But not specifically for this. So I think it's not that hard to implement on top of existing checks !?
It might force a major version, as this can be technically breaking, but on the other hand, I think we'll need a major version anyway to be able to introduce some strict mode that checks that Prometheus naming conventions are followed. SDK strict mode should be the default and I think it should be possible to turn it off generally or per metric.
Even with this validation, the user might run into problems later due to federation or some other feature.
SHOULD NOT conflict
As you say, we can explain why it's bad, but no burden on anyone, the ingestor will just reject the sample if it runs into it. This is simpler. It would be super annoying if we rejected the whole scrape due to one metric.
Conclusion
I think to avoid breaking change due to OM2.0 I'd also say SHOULD NOT.
But I'll continue to advocate for SDKs with default strict mode that checks that the name specified follows Prometheus naming conventions.
Uh oh!
There was an error while loading. Please reload this page.
Fixes prometheus/OpenMetrics#305
(削除) We can either merge this with TODOs before complex values/types or wait for complex type/values. (削除ここまで)