-
Notifications
You must be signed in to change notification settings - Fork 15
better timegroup-macro handling for sub-second intervals #262
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't this break existing queries? ( If I understand correctly, this new one return milliseconds instead of seconds?? 🤔 )
I guess it is a valid point that if users are today parsing it as below, it would be a problem to update this directly:
Basically, users would then have to shift to A softer transition may be to create a new macro and explain it in the documentation, e.g. call it as below:
It is of course more clean to just have one option, but it will be an abrupt transition for existing users. |
@yesoreyeram thanks for raising this point.. but, after some more thinking, it should be still fine. the reason is this:
so i think it should be ok. WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense Gabor. Thanks for claryfying.
(fixes #257)
the
$__timeGroup(col, '5s')
macro creates roughly this:TIMESTAMP_SECONDS(DIV(UNIX_SECONDS(col), 5) * 5)
this works fine, but if the interval is smaller than
1second
, for example 50 milliseconds, it becomes this:TIMESTAMP_SECONDS(DIV(UNIX_SECONDS(col), 0.05) * 0.05)
.the problem is the
DIV(.... , 0.05)
part. it does not work with non-integer values.the solution is to switch from seconds to milliseconds. it's what this PR does. (thanks @MatinF for looking into this!)