Forum Discussion

Connor_D_'s avatar
3 years ago

OpenMetrics: How to use a Label Expression with more than one variable value?

Greetings;

I am using an OpenMetrics datasource to scrape HAProxy stats from a Prometheus exporter.  This works well for datapoints such as:

nova_frontend_connections_total{frontend="stats"

...for which I construct a Datapoint using "Label Expression", "frontend=##WILDVALUE##."

I have a series of stats with two variables and can't work out how to implement those such as the following:

ova_frontend_http_responses_total{code="1xx",frontend="acme"} 0
nova_frontend_http_responses_total{code="1xx",frontend="acme-ca"} 0
nova_frontend_http_responses_total{code="1xx",frontend="nova-ssl-1920"} 0
nova_frontend_http_responses_total{code="1xx",frontend="stats"} 0
nova_frontend_http_responses_total{code="2xx",frontend="acme"} 0
nova_frontend_http_responses_total{code="2xx",frontend="acme-ca"} 0
nova_frontend_http_responses_total{code="2xx",frontend="nova-ssl-1920"} 0
nova_frontend_http_responses_total{code="2xx",frontend="stats"} 990
nova_frontend_http_responses_total{code="3xx",frontend="acme"} 0
nova_frontend_http_responses_total{code="3xx",frontend="acme-ca"} 0
nova_frontend_http_responses_total{code="3xx",frontend="nova-ssl-1920"} 0
nova_frontend_http_responses_total{code="3xx",frontend="stats"} 0
nova_frontend_http_responses_total{code="4xx",frontend="acme"} 0
nova_frontend_http_responses_total{code="4xx",frontend="acme-ca"} 0
nova_frontend_http_responses_total{code="4xx",frontend="nova-ssl-1920"} 1
nova_frontend_http_responses_total{code="4xx",frontend="stats"} 0
nova_frontend_http_responses_total{code="5xx",frontend="acme"} 0
nova_frontend_http_responses_total{code="5xx",frontend="acme-ca"} 0
nova_frontend_http_responses_total{code="5xx",frontend="nova-ssl-1920"} 0
nova_frontend_http_responses_total{code="5xx",frontend="stats"} 0

Any guidance would be helpful, thanks!

 

1 Reply

  • so the unique values of frontend are the instances, right? That's handled by discovery. So, the 1xx, 2xx, 3xx, 4xx, and 5xx are different datapoints under each instance yeah?

    Unfortunately, i'm not sure of the syntax given the current documentation, but you should be able to reference the code in the datapoint definition using something like "Label Expression", "frontend=##WILDVALUE##,code=1xx". You'd repeat for each of the 5 values of the code tag. Sorry i can't be more help.