Metrics API scaler doesn't parse Prometheus metric with multiple labels #6077
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Looking for support from community
Report
Metrics API Scaler supports reading values in Prometheus format. The problem is that the Prometheus metric parse is just a strings comparison. This works for metrics without labels or just with a single label, but metrics with 2 or more labels are incorrectly parsed, having more fields than the expected amount of fields:
We should parse the Prometheus metrics and then compare the labels to avoid weird behaviors and the requirement of weird escape of the strings
Expected Behavior
Metrics API scaler supports any Prometheus metrics
Actual Behavior
It only supports metrics without labels or with a single label
Steps to Reproduce the Problem
This can be reproduced just updating the unit test
TestGetValueFromResponse
to include a Prometheus response with a metric that has at least 2 labels. e.g:The text was updated successfully, but these errors were encountered: