Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature request: Add ability to snap query time to something other than now or offset #3366
Comments
This comment has been minimized.
This comment has been minimized.
|
This is something you should request of your dashboarding software, as if you want queries aligned in a particular way you should set the start/end accordingly. |
brian-brazil
added
the
component/api
label
Nov 22, 2017
brian-brazil
closed this
Nov 22, 2017
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 23, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
lock
bot
locked and limited conversation to collaborators
Mar 23, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
fortman commentedOct 27, 2017
•
edited
Hi, we have a problem where when a dashboard refreshes, the metrics look like they jump all over the place. The issue really boils down to when the query takes place. If we take a 1m minute increase graph and have it refresh every minute, the graph scrolls perfectly from right to left, because the data is the same. If we refresh in the middle somewhere, say after 26 seconds, we get a completely different data set back (which makes sense).
It would be great to have a function that behaves like offset, but instead of going back to a preset amount of time, instead it 'snaps' to some interval. Cron syntax comes to mind, so let me use that.
Say you want your query to always run at the top of the minute instead of right now, a query could look like
increase(statA[1m] SNAP m)
This query would take place at the top of the current minute (00 secs) no matter if you ran it 20 secs after the minute, or 25 secs after the minute. Your graph would look the same until the minute rolls over. If you specify 'snap h' instead of 'snap m', then it would always take place at the top of the current hour.
Also in the cron mentality, you could have 'snap h/4'. That would go back to the previous 15 minute interval from the top of the hour. 'snap h/2' would make the queries go back to the previous 00 or 30 minute time.
It could even be used with offset, like so
increase(statA[1m] offset 10m snap m)
Anyways, I think this would be really useful, just not sure how easy it would be to implement. At first I thought about requesting another function like hour or minute, called second. Then we would use that function in the offset like
increase(statA[1m] offset second())
to pin it to the top of the minute. Hour and minute don't seem to be compatible with the offset feature, so that is when I thought of the snap function.