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

fix(internal): Fix time parsing for abbreviated timezones #13363

Merged
merged 13 commits into from
Jun 2, 2023

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented May 30, 2023

resolves #12960
upstream issues golang/go#56528, golang/go#9617

Golang does not handle ambiguous timezones which holds true for almost all abbreviated timezones. As a workaround, (see Golang discussion) we can parse times with abbreviated timezones first to get the timezone's name and then forcefully parse the time-string in the found timezone. By doing this we can handle many of the abbreviated timezones correctly assuming the "most probable" of the ambiguous timezone abbreviations, e.g. "Mountain Standard Time" for "MST".

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label May 30, 2023
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label May 30, 2023
@srebhan srebhan requested a review from Hipska May 30, 2023 15:55
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have questions about the behavior and what we are expecting from the change.

internal/internal.go Show resolved Hide resolved
internal/internal.go Show resolved Hide resolved
internal/internal.go Show resolved Hide resolved
@srebhan
Copy link
Member Author

srebhan commented Jun 2, 2023

After a short discussion, we concluded to make the change in behavior more visible. @powersj does the warning and Changelog text work for you?

internal/internal.go Outdated Show resolved Hide resolved
internal/internal.go Outdated Show resolved Hide resolved
internal/internal.go Outdated Show resolved Hide resolved
internal/internal.go Outdated Show resolved Hide resolved
once.Do(func() {
log.Print("W! You are using abbreviated timezones for which parsing was fixed in v1.27.0.")
log.Print("W! Please remove any workarounds in place and check your resulting times carefully!")
log.Print("W! In case you experience any problems, please file an issue!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Print("W! In case you experience any problems, please file an issue!")
log.Print("W! If you experience any problems, please file an issue on GitHub")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this line can be removed, this counts for any problem experienced, not only for timezones.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hipska I like to encourage people to report the stuff, so the line is well spend IMO. This worked quite well for the gnmi plugin...

Copy link
Contributor

@Hipska Hipska Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but there it is in a single log message, not spread over multiple independent lines.. Please keep the messages together!

It is now fine as the multiple log messages are now also combined into one.

internal/internal.go Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Jun 2, 2023

@powersj powersj merged commit 97d10a5 into influxdata:master Jun 2, 2023
@srebhan srebhan added this to the v1.27.0 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telegraf/golang does not parse timezone correctly from timestamp
3 participants