Gauge metric table

What happened?

I am trying to build some dashboards using a gauge metric. However, I’m seemingly having trouble in creating a query that would make it possible. I’m wondering if it’s possible or not.

What did you expect to happen? I currently have a gauge metric called up, with labels such as city, building, device_name reporting 1 for on and 0 for off. I would like to create a table with the following headers: city, building, on, off. The query should aggregate the metrics with the same city, building, but unique device_name with a value of 1, as well as 0 over the last 10m. So at a given timestamp, it should only display that metric with a unique combination of city and building, with the column 1 representing the number of unique device_name, and column 0 representing the number of unique device_name with 0.

Currently, the interval is set at 1m, but it doesn’t seem to be configurable.

I seem to be having some trouble making this work. Is there a way of doing this query/table?

Thanks

What is your datasource? Can you arrange data in the form you need by datasource capabilities?

The datasource is prometheus. Can you clarify what you mean by datasource capabilities?

Some datasources have huge capabilities on data transformation / preparation. For example, using flux in InfluxDB it is possible to group data etc., so as Grafana had just to visualize it.

1 Like

Thanks.

I was able to resolve the issue by enabling format: table, type: instant in the legend.