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: Add noise plugin #10057

Merged
merged 19 commits into from
Jan 12, 2022
Merged

feat: Add noise plugin #10057

merged 19 commits into from
Jan 12, 2022

Conversation

shypard
Copy link
Contributor

@shypard shypard commented Nov 4, 2021

This PR adds a noise plugin which uses various probability density functions (Laplace, Gaussian, Uniform) to generate a random value, which is then used to modify the original field value. Exclusions for fields or metrics can be configured in the config file.

Required for all PRs:

resolves #10012

Copy link
Member

@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.

Wow this is already quite nice @wizarq! Nevertheless, I have some comments. Please take a look and let me know once you are done.

plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise_test.go Outdated Show resolved Hide resolved
Copy link
Member

@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.

Thanks for the update @wizarq! Some more comments in the code, especially moving the fieldFilter and noise variables to the struct instead of using global variables and the use of the distuv.Rander interface.

Furthermore, you have to add gonum.org/v1/gonum to the license list in docs/LICENSE_OF_DEPENDENCIES.md. Note the alphabetic order in that file. :-)

plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
Copy link
Member

@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.

Thanks for the very nice update @wizarq! I have some comments on the overflow/underflow checks and usage of table-based tests. Please take a look there.

plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise_test.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise_test.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise_test.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise_test.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise_test.go Outdated Show resolved Hide resolved
@telegraf-tiger
Copy link
Contributor

⚠️ This pull request increases the Telegraf binary size by 1.07 % for linux amd64 (new size: 132.9 MB, nightly size 131.5 MB)

📦 Looks like new artifacts were built from this PR.

Expand this list to get them **here**! 🐯

Artifact URLs

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

Copy link
Member

@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.

@wizarq nice update and I think we are almost there. Some minor comments remain though... Keep up the good work!

plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
plugins/processors/noise/noise_test.go Outdated Show resolved Hide resolved
Copy link
Member

@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.

Very good. Please remove the section from the sample config (see my comment) and fix the linter issues in README.md then we are good to go (click on "Details" next to the red "X" for the findings)...

plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
Copy link
Member

@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 your effort @wizarq!

@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 Nov 30, 2021
Copy link
Contributor

@reimda reimda left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Great test coverage!

plugins/processors/noise/README.md Show resolved Hide resolved
plugins/processors/noise/README.md Show resolved Hide resolved
plugins/processors/noise/noise.go Show resolved Hide resolved
plugins/processors/noise/noise.go Outdated Show resolved Hide resolved
@srebhan srebhan requested a review from reimda December 14, 2021 08:43
@shypard shypard requested a review from srebhan December 23, 2021 13:56
@shypard shypard requested a review from powersj January 5, 2022 16:48
go.mod Show resolved Hide resolved
plugins/processors/noise/README.md Outdated Show resolved Hide resolved
plugins/processors/noise/noise.go Show resolved Hide resolved
Copy link
Member

@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.

@wizarq I have two more comments. Furthermore, I'm not sure on how to proceed with the metric.Now() inherent type conversion, so I'll leave this to the other guys. ;-)

@shypard shypard requested a review from srebhan January 7, 2022 08:21
Copy link
Member

@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.

Beautiful @wizarq, just beautiful. Looks good to me. Thanks @wizarq for your effort!

@srebhan srebhan added ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. and removed ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Jan 11, 2022
@reimda
Copy link
Contributor

reimda commented Jan 11, 2022

@wizarq Could you resolve the go.mod conflict and we'll merge this? Thanks again!

@shypard
Copy link
Contributor Author

shypard commented Jan 12, 2022

@wizarq Could you resolve the go.mod conflict and we'll merge this? Thanks again!

I fixed the conflict in go.mod and synced the branch to the current head. The circleci however fails because of some non-related TestCSVMultiHeaderWithSkipRowANDColumn test.

@telegraf-tiger
Copy link
Contributor

@powersj powersj merged commit a6b998f into influxdata:master Jan 12, 2022
noise_type = "laplacian"
include_fields = []
exclude_fields = ["usage_steal", "usage_user", "uptime_format", "usage_idle" ]
namedrop = ["swap", "disk", "net"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Using namepass = ["cpu"] would make more sense in my opinion.

powersj pushed a commit to powersj/telegraf that referenced this pull request Jan 21, 2022
powersj pushed a commit to powersj/telegraf that referenced this pull request Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new plugin plugin/processor 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.

Add noise processor plugin
5 participants