You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The prometheus metrics endpoint for an IoT tutorial emits metrics with no space after the metric like this:
# HELP pm02 Particulate Matter PM2.5 value
# TYPE pm02 gauge
pm02{id="airgrad0",mac="FF:FF:FF:FF:FF:FF"}11
# HELP rco2 CO2 value, in ppm
# TYPE rco2 gauge
rco2{id="airgrad0",mac="FF:FF:FF:FF:FF:FF"}532
# HELP atmp Temperature, in degrees Celsius
# TYPE atmp gauge
atmp{id="airgrad0",mac="FF:FF:FF:FF:FF:FF"}22.10
# HELP rhum Relative humidity, in percent
# TYPE rhum gauge
rhum{id="airgrad0",mac="FF:FF:FF:FF:FF:FF"}40
Parsing this didn't error but instead produced metrics with incorrect values:
I think ideally perhaps it should raise a ValueError in this circumstance (or alternatively support this if it's considered a valid metrics format; I didn't find a spec on what the exact format is).
The text was updated successfully, but these errors were encountered:
Within a line, tokens can be separated by any number of blanks and/or tabs (and must be separated by at least one if they would otherwise merge with the previous token).
Since in your example the value could not merge with the previous token due to having curly braces for labels I think your example should be valid and parse the full number. I also tested with the Go parser and it properly parsed your examples. I will ask around a little bit to see if there is consensus on that though.
I talked about this with a couple other Prometheus maintainers and we think the best path forward is to support the lack of space for the Prometheus format. It works with Prometheus today due to the Go parser accepting the format, so making a space required would break some users. Generally speaking the Prometheus format is a bit under specified, which is part of what OpenMetrics fixes.
Note that in OpenMetrics the space is required by the spec.
The prometheus metrics endpoint for an IoT tutorial emits metrics with no space after the metric like this:
Parsing this didn't error but instead produced metrics with incorrect values:
I think ideally perhaps it should raise a
ValueError
in this circumstance (or alternatively support this if it's considered a valid metrics format; I didn't find a spec on what the exact format is).The text was updated successfully, but these errors were encountered: