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
[Feat] $__timeGroup support floor rounding #12460
Comments
The values you posted are 7:00 and 8:00 in UTC so they land in 2 buckets if you group by 1 hour.
It might be beneficial if timeGroup would allow passing an offset especially if you group by day you might not want timeGroup to group by UTC day but by your local day |
@svenklemm thanks, my timezone is UTC+8, no half hour problem I think the problem is caused by casting as integer if $__timeGroup(column, '1h', 0) can be converted to UNIX_TIMESTAMP(column) div 3600 * 3600, that will be very helpful. The $__timeGroup macro's fill default value feature help me draw 0 value in the graph, otherwise I will use |
Hmm you are actually right and there might be rounding involved i have to investigate this further. It should always use floor though and on postgres it does as far as i'm aware but it might not on other databases
|
@yangliuyu OK i double checked on postgres and its not correct there aswell, i think the current behaviour is a bug. |
I have installed grafana v5.1.3 commit: 0871432 on a CentOS 7.4.1708 server, using a MySql 7 database as datasource
I want to group some event by hours, which use $__timeGroup(column, '1h', 0) and want event created_at at whether 17:29:00 or 17:31:00 will be grouped in the same 17 time slot, but the result is grouped into 2 hour slot 17 and 18
The problem is cause by cast rounding, for example:
Is there any configuration that I can controll the $__timeGroup(column, '1h', 0) which can be converted to UNIX_TIMESTAMP(column) div 3600 * 3600
The text was updated successfully, but these errors were encountered: