Convert group by query from InfluxDB to PromQL for bar charts in Grafana

468 views
Skip to first unread message

s.kart...@happyfox.com

unread,
Apr 11, 2017, 12:07:40 AM4/11/17
to Prometheus Users
Hi,

I am trying to port the following InfluxDB query using PromQL. I am running this query for minute by minute stats of an increasing counter and to plot them using Grafana. The counter might not have any change at a given series of minutes thus I am using increase to note the increase in the value per minute and then taking the max of it. Also I am using timeFilter which sets the date and time in the dropdown in Grafana to the where condition thus gives the stats with respect to the date selected. Offset can be used but how can I give a date as a value instead of using terms like 5w to denote 5 weeks since that will require some transformation to be done from the Grafana UI dropdown value. Some discussion has been done on https://github.com/prometheus/prometheus/issues/1888 but I am using Grafana instead of prometheus UI . The problem I am facing with the query output is that InfluxDB query gives neat bar charts and I can stack up various queries too. But the same PromQL queries gives a continuous series and I am not able to form bar charts with it as in InfluxDB

Query : 

SELECT count(*) FROM “foo_counter” WHERE $timeFilter GROUP BY time(1m)

PromQL : 

max_over_time(increase(foo_counter[1m]))

Referred the following links : 


Thanks a lot for all the great work
Reply all
Reply to author
Forward
0 new messages