-
Notifications
You must be signed in to change notification settings - Fork 820
Closed
Description
Hi Brian,
This is in reference to promregator/promregator#73, where a tricky situation with HELP
lines happens. Here is the situation in a nutshell:
- Promregator parses Prometheus' Exposition Format requests and aggregates/forwards them.
- For this, Promregator has its own Prometheus' Exposition Format parser. The parser is tolerant enough to accept metrics without a
# HELP
line. - The format itself explicitly permits that both
# HELP
and# TYPE
are optional (see also https://prometheus.io/docs/instrumenting/exposition_formats/#grouping-and-sorting, first sentence there). - Promregator's parser outputs its data in the
MetricFamilySamples
format. - After a lot of processing, in the end the class
TextFormat
(of this project here) is used to generate a proper Exposition Format string again, which then is sent to Prometheus. - NPE due to missing
# HELP
statement in the scraped metrics promregator/promregator#73 documents a situation, where a metric without# HELP
line is processed through the system - and fails. - As
client_java/simpleclient_common/src/main/java/io/prometheus/client/exporter/common/TextFormat.java
Line 23 in 1950cff
writer.write("# HELP "); metricFamilySamples.help
isnull
, an NPE is raised.
I also stumbled over the check at
client_java/simpleclient/src/main/java/io/prometheus/client/SimpleCollector.java
Line 165 in 1950cff
if (b.help.isEmpty()) throw new IllegalStateException("Help hasn't been set."); |
In general, I am quite in favor that metrics should have a help. However, the TextFormat
class currently only implements a subset of the specification and for my case this causes compatibility issues.
What do you think about the situation?
- Is it possible to relax (only) the
TextFormat
class in that sense? (a PR would not be rocket science - only the unit tests would be a little tricky). - Was there a special intention behind the idea to enforce help strings even though the protocol is more generous?
Thanks for your insights!
Metadata
Metadata
Assignees
Labels
No labels