-
Notifications
You must be signed in to change notification settings - Fork 66
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
Month and year data tags not in local timezone #80
Comments
I have done some testing of this issue. I'm still unsure if this is a problem only on my system, or other people experience the same problem? To test this, I changed my system time to the beginning of Oct and let it start logging data (without changing anything else at this point). The logged data was being tagged with a month value of "Sep" (when it should be Oct) which can be seen on the yellow plot line below. I then edited [[processors.date]]
tag_key = "month"
date_format = "Jan"
timezone = "Australia/Sydney"
[[processors.date]]
tag_key = "year"
date_format = "2006"
timezone = "Australia/Sydney" The month tag was then being set to "Oct" which is correct for my timezone and can be seen on the green plot line above. I tried changing the timezone value in # docker exec -it telegraf sh -c "cat /etc/timezone; date"
Etc/UTC
Fri Sep 30 16:31:32 UTC 2022 Given this, it seems the timezone should be configured in |
Awesome work @mcbirse !!! You are brilliant. This is a bug that has been there since the start (so unfortunately our tags are all bad). I'm seeing this on my system showing a bad month tag change happening at 8/31 @ 17:00 localtime which makes sense since I'm UTC-7 in Los Angeles. I expect this is causing errors in any the graphs that use the tags for grouping. Correct me if I'm wrong, but none of the dashboard graphs are currently using these tags which explains why this wasn't discovered before now. Getting the correct tags will be helpful for addition visualization as well as auxiliary scripts or tools using this data. Again, thank you @mcbirse ! Great detective work! |
No worries Jason, I'm glad I found this, so we can fix it! 😊
Yes it would be if tags were used for grouping. But you are correct - fortunately I cannot find any queries in the dashboards where a GROUP BY "month" has actually been used. Going forward though, it will be good to ensure this is working correctly. It does give options to query data by the "month" tag which could be useful, for instance as per the heatmap discussion. I started looking into how to fix the tags in existing data. It's not simple. 😞 There seems to be a lot of limitations with InfluxDB, so you cannot simply update tag values. The process seems to be: export data to a file, change data points with the wrong tags, import the data back. Then you need to delete the existing data in InfluxDB with the wrong tags, as the import will not "update" existing points, it will add additional points with the correct tag. Deleting data is another issue: you can't delete measurements from specific retention policies - only all of them. i.e. this won't work: DELETE FROM autogen.http WHERE month='Jun' AND time >= '2022-07-01T00:00:00+10:00' AND time < '2022-08-01T00:00:00+10:00'
ERR: error parsing query: retention policy not supported at line 1, char 1 But you could do this: DELETE FROM http WHERE month='Jun' AND time >= '2022-07-01T00:00:00+10:00' AND time < '2022-08-01T00:00:00+10:00' However, it will delete the data in "http" of ALL retention policies. i.e. autogen, raw, kwh, daily, grid, vitals, etc. As long as the data that is imported back includes all of that though, I guess it is doable. I haven't fully worked out the process yet though. |
I've noticed what seems to be an issue with tagging of data by month/year, in that it seems to tag the data points in UTC regardless of the
tz('your/timezone')
used in the CQ query.Here's an example, where you see the "month" tag of my data is changing month at 10am, since my timezone is +10 (at the moment) 😞
You can see the issue if you query the InfluxDB directly.
Three query examples below:
Because of this issue, grouping by month/year tags seems completely pointless and useless, unless you live in UTC timezone and do not have daylight savings!
Is anyone else seeing this issue, or is it just a problem with my setup/system?
I have done some further digging to understand where the month/year tags come from, and I think this is configured in
telegraf.conf
?Checking docs for telegraf, and I discovered the below:
Configuration
I wonder if this is the problem, and
telegraf.conf
should be including atimezone
value in the[[processors.date]]
section to ensure tags for month/year are localized?The text was updated successfully, but these errors were encountered: