-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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(outputs.postgresql): Add option to create time column with timezone #13763
Conversation
@phemmer would love to get your review on this one too! |
With my limited testing this seems to do what I'm looking for. |
Seems fairly reasonable. telegraf/plugins/outputs/postgresql/postgresql.go Lines 73 to 85 in 879c42d
But it's just personal preference. What you have is functionally fine. One change I might suggest though is how to specify the type. Instead of a boolean, use a more generic "timestamp_type" field with a text value which can be "timestamptz" (or "timestamp with timezone" for the full name). This makes it more future proof, as it's possible in the future there might be some other data type, such as integer, which would require another parameter, and make everything rather messy. Oh, and I think this change might be incomplete as it is. Just changing the column type to timezone doesn't serve much purpose. telegraf point timestamps don't contain timezone information. So you have to pull a timezone from somewhere. Where is this coming from? |
That is reasonable and I will do that. Regarding the defaults for the column: I like to do it in |
Let me know when the next test binary is posted and I can give it a shot. |
0160825
to
c42018c
Compare
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
This is working as I'd expect for cases when my provided time string is |
resolves #13747
based on #13750
This PR adds the ability to switch the time-column to PostgeSQL's "timestamp with time zone" type allowing to issue queries with timezones. Please note, the timestamp is still always transmitted as UTC!