-
Notifications
You must be signed in to change notification settings - Fork 845
Prometheus parser 0.22.0 raises ValueError when parsing HELP, INFO comments with double spaces #1131
Copy link
Copy link
Closed
Labels
Description
Issue
Starting with version 0.22.0, comment lines that are INFO, HELP will fail to parse if they contain double spaces between parts.
Example:
We have a particular service which exposes metrics in this format:
# HELP jvm_heap_size_bytes jvm heap stat
# TYPE jvm_heap_size_bytes gauge
jvm_heap_size_bytes{type="max"} 8589934592
jvm_heap_size_bytes{type="committed"} 1736441856
jvm_heap_size_bytes{type="used"} 1123733504
Expected behaviour:
Metrics of this service are successfully parsed.
list(text_fd_to_metric_families(fd)) should result with
[Metric(jvm_heap_size_bytes, jvm heap stat, gauge, , [Sample(name='jvm_heap_size_bytes', labels={'type': 'max'}, value=8589934592.0, timestamp=None, exemplar=None), Sample(name='jvm_heap_size_bytes', labels={'type': 'committed'}, value=1736441856.0, timestamp=None, exemplar=None), Sample(name='jvm_heap_size_bytes', labels={'type': 'used'}, value=1123733504.0, timestamp=None, exemplar=None)])]
(the behavior in 0.21.1)
Current behaviour:
Metrics for this service are not collected anymore since upgrading to 0.22 because of the ValueError raised during parse.
A ValueError is raised for the second and third comment lines above, as because of the double spaces, the second part becomes an empty string
Reactions are currently unavailable