Hi, I have an instant query that returns some data from Prometheus and I want to visualize this as a bar chart in Grafana. The data looks like this:
timeout=a, browser=chrome, value=1
timeout=b, browser=chrome, value=2
timeout=a, browser=safari, value=4
timeout=b, browser=safari, value=2
It measures the value
for each combination of browser
and timeout
.
I want to display this data in a bar chart (with a bar per browser) and to have timeout
on the x-axis and value
on the y-axis.
If I apply group by
transformation on timeout
field and apply calculate (all unique values)
on the browser
field, I get a table like this
| timeout | browser(uniqueValues)
---------------------------------
| a | [“chrome”, “safari”]
| b | [“chrome”, “safari”]
I can then apply extract fields
transformation on browser(uniqueValues)
and I get:
| timeout | browser(uniqueValues) | chrome | safari
----------------------------------------------------
| a | [“chrome”, “safari”] | chrome | safari
| b | [“chrome”, “safari”] | chrome | safari
How do I get the actual value of chrome
and safari
? What I expect is
| timeout | browser(uniqueValues) | chrome | safari
----------------------------------------------------
| a | [“chrome”, “safari”] | 1 | 4
| b | [“chrome”, “safari”] | 2 | 2
Is there a better way to do this?