- What Grafana version and what operating system are you using? v10.3.3 / Docker
- What are you trying to achieve?
I’m in the process of converting over from InfluxDB v2 to VictoriaMetrics (ie: Prometheus). I’ve successfully ETL’d all the data out of InfluxDB into VM, and now I’m working on the Grafana dashboards, rewriting InfluxDB Flux language to PromQL. I’m struggling on this one particular graph.
The graph, when Influx, uses 2 queries. The 1st query calculates the start, and end date of the current month, passing those to the “|> range()” part of the Flux query. The 2nd query does the same thing, but subtracts 1 year.
This gives me a single visualization, comparing “current month, this year” (green bars) to “current month, last year” (blue bars).
I cannot figure out how to accomplish this in PromQL. Everything I’ve searched for says to manipulate the date using the date selector at the top of Grafana. But that doesn’t work in my case because I cannot select 2 ranges. Additionally, the dashboard should not require user input; it should automatically select the current month.
How can I change/modify the date range used by PromQL in my visualizations like I did with Influx?