I have some metrics from a Prometheus data-source like this (the real data contains many more label combinations):
status{pod = "A", platform = "X",} 1
status{pod = "C", platform = "X",} 3
status{pod = "A", platform = "Y",} 5
status{pod = "A", platform = "P",} 8
status{pod = "C", platform = "Y",} 7
status{pod = "B", platform = "Y",} 4
status{pod = "B", platform = "P",} 1
For which I need to display the info with a Grafana visualization like this:
X | Y | P | |
---|---|---|---|
A | 1 | 5 | 8 |
C | 3 | 7 | |
B | 4 | 1 |
The labels pod
and platform
cannot be hard-coded into the visualization configuration but it needs to be taken from the values from the metrics.
So basically, I need to:
- take the
pod
label values as row values for the first column, - take the
platform
label values as the column names for the next columns and, - take the metric values as the intersection between pod and platform as depicted above.
I tried using the Table Panel using the Labels to fields transformation but couldn’t get it working.
So, how could I achieve the described scenario? I’m open to any suggestion that could give me a similar result.
I’d be really thankful for any insights you could provide me with.
Posted originally on Grafana Community. Posted here to reach wider audience