Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add ability to snap query time to something other than now or offset #3366

Closed
fortman opened this Issue Oct 27, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@fortman
Copy link

fortman commented Oct 27, 2017

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.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 28, 2017

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.

@lock

This comment has been minimized.

Copy link

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 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.
You can’t perform that action at this time.