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

feat(parsers.influx): Allow a user to set the timestamp precision #13419

Merged
merged 7 commits into from
Jul 13, 2023

Conversation

powersj
Copy link
Contributor

@powersj powersj commented Jun 9, 2023

fixes: #13600

@telegraf-tiger telegraf-tiger bot added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins labels Jun 9, 2023
@powersj powersj self-assigned this Jun 9, 2023
@Hipska
Copy link
Contributor

Hipska commented Jun 10, 2023

This is nice to have, but it does not fix the specific request in #13407

@eth5201314
Copy link

I noticed that your license is unclear. Can you provide more information about how your code can be used?

@powersj powersj marked this pull request as ready for review July 11, 2023 15:27
@powersj powersj 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 Jul 11, 2023
Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Just one small comment...

@srebhan
Copy link
Contributor

srebhan commented Jul 12, 2023

@eth5201314 I'm not exactly sure what you are asking... Is your question related to Telegraf as a whole?

plugins/parsers/influx/influx_upstream/parser_test.go Outdated Show resolved Hide resolved
plugins/parsers/influx/parser_test.go Outdated Show resolved Hide resolved
Comment on lines +160 to +168
timeDuration := time.Duration(p.InfluxTimestampPrecsion)
switch timeDuration {
case 0:
case time.Nanosecond, time.Microsecond, time.Millisecond, time.Second:
p.SetTimePrecision(timeDuration)
default:
return fmt.Errorf("invalid time precision: %d", p.InfluxTimestampPrecsion)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Why 2 different implementations? In the upstream parser, you added this check in the SetTimePrecision func.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the issue is that the original influx parser is code-generated and therefore we cannot simply add/modify the function. I'm fine with the second instance...

Copy link
Contributor

Choose a reason for hiding this comment

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

But why not align them to look the same?

plugins/parsers/influx/influx_upstream/parser_test.go Outdated Show resolved Hide resolved
plugins/parsers/influx/parser_test.go Outdated Show resolved Hide resolved
powersj and others added 5 commits July 12, 2023 08:16
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
@telegraf-tiger
Copy link
Contributor

Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip.
Downloads for additional architectures and packages are available below.

⚠️ This pull request increases the Telegraf binary size by 3.46 % for linux amd64 (new size: 193.8 MB, nightly size 187.4 MB)

📦 Click here to get additional PR build artifacts

Artifact URLs

DEB RPM TAR GZ ZIP
amd64.deb aarch64.rpm darwin_amd64.tar.gz windows_amd64.zip
arm64.deb armel.rpm darwin_arm64.tar.gz windows_arm64.zip
armel.deb armv6hl.rpm freebsd_amd64.tar.gz windows_i386.zip
armhf.deb i386.rpm freebsd_armv7.tar.gz
i386.deb ppc64le.rpm freebsd_i386.tar.gz
mips.deb riscv64.rpm linux_amd64.tar.gz
mipsel.deb s390x.rpm linux_arm64.tar.gz
ppc64el.deb x86_64.rpm linux_armel.tar.gz
riscv64.deb linux_armhf.tar.gz
s390x.deb linux_i386.tar.gz
linux_mips.tar.gz
linux_mipsel.tar.gz
linux_ppc64le.tar.gz
linux_riscv64.tar.gz
linux_s390x.tar.gz

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for the update @powersj!

@srebhan srebhan requested a review from Hipska July 12, 2023 15:35
@Hipska
Copy link
Contributor

Hipska commented Jul 12, 2023

Let's check after a new nightly build? I don't like that warning of file size change 😛

@powersj powersj merged commit 14f52ea into influxdata:master Jul 13, 2023
24 checks passed
@powersj powersj deleted the fix/13407 branch July 13, 2023 17:09
@github-actions github-actions bot added this to the v1.28.0 milestone Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins 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.

Implement ability to specify input precision in influxdb parser
4 participants