Let’s imagine I have a metric called calories
and two labels called type
and name
. type
says whether we have fruit
or vegetable
, name
is a name of the fruit or vegetable e.g. carrot
, onion
, banana
, orange
, apple
. What I would like to do is to create a single stat panel that would be repeated in rows in the following way (of course - refreshed dynamically on dashboard load):
row 1: vegetables with panels for carrot
and onion
row 2: fruits with panels for banana
, orange
, apple
My attempt so far is two vars on the dashboard level:
$types = label_values(type)
$names = label_values(calories{type=~"$types"}, name)
and I am repeating rows for types
and repeating panels for names
however unfortunately I am getting all the names (both fruits and veggies) in both rows.
First of all - is this achievable what I am trying to do?
If so - what am I doing wrong?
Thanks!