-
What Grafana version and what operating system are you using? 11.2.3(ecc4799abc)
-
What are you trying to achieve? Remove empty intervals from my dashboard. in the attached image i do not want to see the empty 3 hour intervals between 9am and 10am.
-
How are you trying to achieve it? flux query only return from 9am to 10am, but the dashboard uses default intervals that display and they contain no data. I only want the hour from 9am to 10am to show up in the dashbaord.
-
What happened? n/a
-
What did you expect to happen? to only see the hour of 9am to 10am
-
Can you copy/paste the configuration(s) that you are having problems with? N/A
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were. N/A
-
Did you follow any online instructions? If so, what is the URL? n/a
Welcome @jerryband
Can you share your Flux query?
Sure, no problem, I just ask you be kind, lol. I am very new to both flux and grafana.
mport “date”
from(bucket: “mybucket”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “my.mesurement””
)
|> filter(fn: (r) => r.queue == “my.queue” and r.node == “node1”
)
|>filter(fn: (r) =>
date.weekDay(t: r._time) >= 1 and
date.weekDay(t: r._time) <=5
)
//Only show from 9-10 EST but needs to be in UTC below.
|> hourSelection(start: 14, stop: 14)
// Aggregate data at 2 hour intervals if the time range selected is greater than 2 days
|> aggregateWindow(every: if uint(v:v.timeRangeStop) - uint(v:v.timeRangeStart) >= 172800000000000 then 10m else 1m, fn:last , createEmpty: false )
Thanks @jerryband
Your query looks good. How about just changing the graph style to Bars?
Is the above what you envisioned?
Tip: you can format any code by enclosing the desired text in the "Preformmatted Text’ button at the top. I did that below:
import "date"
from(bucket: "mybucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "my.mesurement")
|> filter(fn: (r) => r.queue == "my.queue" and r.node == "node1")
|>filter(fn: (r) =>
date.weekDay(t: r._time) >= 1 and
date.weekDay(t: r._time) <=5
)
//Only show from 9-10 EST but needs to be in UTC below.
|> hourSelection(start: 14, stop: 14)
// Aggregate data at 2 hour intervals if the time range selected is greater than 2 days
|> aggregateWindow(every: if uint(v:v.timeRangeStop) - uint(v:v.timeRangeStart) >= 172800000000000 then 10m else 1m, fn:last , createEmpty: false )
It is similar to what I want to see, but I really want the large intervals with no data removed. For example on your panel you have a large from 2/28 00:00 to 3/2 00:00 that has no data and I would like to remove these time gaps that are empty.
So for the “Time Series” graph in Grafana or InfluxDB, it really has to be continuous. AFAIK, there is no way to show only the ‘active’ hours.
Maybe the Window function in InfluxDB might help?
Changing to a bar chart does help some, I think I can play around with this and get the panel to look cleaner, but it certainly would be nice to have the ability to hide intervals(dates/times) all together that do not contain data.
I was actually able to get this working better today. I used your bar chart suggestion and tweaked my query, I added this filter to it –
|>filter(fn: (r) =>
date.hour(t: r._time) == 14 and date.minute(t: r._time) >=30 or
date.hour(t: r._time) == 15 and date.minute(t: r._time) <30)
and removed this |> hourSelection(start: 14, stop: 14)
Looks much better now. Thanks for the help!