Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics API scaler doesn't parse Prometheus metric with multiple labels #6077

Closed
JorTurFer opened this issue Aug 14, 2024 · 0 comments · Fixed by #6078
Closed

Metrics API scaler doesn't parse Prometheus metric with multiple labels #6077

JorTurFer opened this issue Aug 14, 2024 · 0 comments · Fixed by #6078
Labels
bug Something isn't working good first issue Good for newcomers help wanted Looking for support from community

Comments

@JorTurFer
Copy link
Member

JorTurFer commented Aug 14, 2024

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:

image

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:

inputPrometheus := []byte(`# HELP backend_queue_size Total number of items
# TYPE backend_queue_size counter
backend_queue_size{queueName="zero"} 0
backend_queue_size{queueName="one"} 1
backend_queue_size{queueName="cache_enabled", instance="qa-khoffman-develop"} 3`)
@JorTurFer JorTurFer added bug Something isn't working good first issue Good for newcomers help wanted Looking for support from community labels Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Looking for support from community
Projects
Status: Ready To Ship
Development

Successfully merging a pull request may close this issue.

1 participant