I am using Influx DB together with Grafana and I want to display data grouped by time(5s). The data represents the requests done to a service for a certain period of time. For example the requests are being executed for a period of one minute from timestamp 2020-10-16 14:09:13 to 2020-10-16 14:10:13.
I am trying to group by time(5s) in order to compute the average on each 5 seconds.
The issue I am facing is that instead of having intervals starting from 14:09:13 they are starting from 14:09:10 causing the total number of requests on the interval to be affected.
My question is whether there exist some way to group by the data by time such that the starting point will be the first timestamp I am interested and not some Influx define timestamp?
Welcome! Can you please share your query? The group by should start on your start time.
Here is the query that I am using:
select mysum/5 from (select sum(Value) as mysum from DataPoint where “Name”=~ /HTTP_[0-9][0-9][0-9]/ and RunID=‘res-16_Oct_2020-11:10:33’ group by time(5s) fill(0))
Here is how the data looks when I select all elements without groupby using the same where clause
Continuation for the above post since I can’t paste 2 images.
Here is the data after applying the group by query from above.
can you please add a where clause with your exact start time as shown here?
Even after adding the start time and endtime on the scenario is not using this values as reference points.
The values are displayed in the attached image.
The query I am using is:
select count(*) from DataPoint where time >= 1602846548000ms and time <= 1602846608000ms and RunID=‘res-16_Oct_2020-11:10:33’ and “Name”=~ /HTTP_[0-9][0-9][0-9]/ group by time(5s)
Using the start time inside the group by time (5s, starttime) solved the issue.