How do I get the value of a metric label into a dashboard panel rather than the number?
My metrics carry useful information in their labels — a version string, a status, a machine name. On a dashboard I keep ending up with the numeric value of the series, which is usually just a 1, when what I want to display is the label.
I can see the labels in the query result, so the data is there. I cannot work out how to get one into a panel as text.
What is the right approach, and why is this awkward rather than a field I can select?
@metrics_meri · 7h ago
It is awkward because of a design decision in the metrics model: a time series is a set of labels plus a stream of numbers, and the query language returns numbers. Labels identify a series; they are not values you can select.
The pattern that exists for exactly your case is the info metric: a series whose value is always 1 and whose labels carry the information. Version numbers, build identifiers and machine metadata are almost always published this way.
So the value being 1 is not a bug, it is the convention — the 1 means "this combination of labels exists".
Getting the label onto a panel is then a display problem rather than a query problem, and there are two routes.
Reply
Report