Interpretation of date range in Grafana UI vs query_range API is wrong
#9,481 建立於 2023年5月18日
描述
Describe the bug
I'm trying to perform analysis on our app using logged data. Because of the volume of data, I need to download the logs in chunks of 6 hours over a few months, using the query_range API. I am using the start and end parameters. Grafana appears to be doing something incorrect with these parameters.
The query_range api does not state whether the end date is an inclusive or exclusive bound. But based on what I'm seeing I think it's an exclusive bound, and Grafana is off by 1 second. I am unsure whether this is just an issue with the UI labels, or it actually sends the wrong parameters to the API when it makes the query.
This could cause analyses to be incorrect because the endpoints of the interval are double-counted or excluded accidentally.
To Reproduce
For example, in the Grafana UI, if I select an absolute time range, then click on the calendar box dropdown to select a single date, it will set the start and end date to 05-03-03 00:00:00 and 05-03-03 23:59:59. The query results state that 23 hours 59 min 59 secs are covered. This means that the last second of the day is not included in the query.
Expected behavior
The end timestamp should be 05-03-04 00:00:00 and the query range should be 24 hours instead of 23 hours 59 min 59 seconds.
Documentation for query_range needs to be clearer around how the ends of the range are handled.