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(outputs.timestream): Support ingesting multi-measures #11385

Merged
merged 24 commits into from
Sep 20, 2022

Conversation

lohithshetty
Copy link
Contributor

@lohithshetty lohithshetty commented Jun 24, 2022

Fixes: #10493

Required for all PRs:

Feature: support ingesting multi-measures to timestream

The feature controlled using the use_multi_measure_records field which is set to false by default for backward compatibility.

@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Jun 24, 2022
@reimda
Copy link
Contributor

reimda commented Jun 24, 2022

Hi Lohith, thanks for the PR. Could you update the sample config to include the new settings? https://github.com/influxdata/telegraf/blob/master/docs/developers/SAMPLE_CONFIG.md#style

Also update readme.md to describe how the settings are useful and maybe link to timestream documentation?

@srebhan
Copy link
Contributor

srebhan commented Jul 8, 2022

Hey @lohithshetty, how does this code relate to the other two PRs (#11094 and #10952) with the exactly same PR title? Can we close those?

@lohithshetty
Copy link
Contributor Author

lohithshetty commented Jul 13, 2022

Hi reimda@, apologies for the delayed response.
I've updated readme.md to include details about multi-measure feature. Thank you.

@lohithshetty
Copy link
Contributor Author

lohithshetty commented Jul 13, 2022

Hi @srebhan the other two PRs (#11094 and #10952) can be closed as this PR covers the same change. Thank you.

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.

Thanks for updateing the PR @lohithshetty! I have some minor comments in the code...

plugins/outputs/timestream/timestream.go Outdated Show resolved Hide resolved
plugins/outputs/timestream/timestream.go Show resolved Hide resolved
Comment on lines 119 to 125
if t.SingleTableDimensionNameForTelegrafMeasurementName != "" {
return fmt.Errorf("in '%s' mapping mode, do not specify SingleTableDimensionNameForTelegrafMeasurementName key", MappingModeMultiTable)
}

if t.UseMultiMeasureRecords && t.MeasureNameForMultiMeasureRecords == "" {
return fmt.Errorf("in '%s' mapping mode, with multi-measure enabled, key MeasureNameForMultiMeasureRecords is required", MappingModeMultiTable)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this different from the code in lines 104 to 110?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@srebhan
When ingesting in MappingModeSingleTable and UseMultiMeasureRecords is enabled, we use measurementName ( from line protocol ) as multiMeasure name in timestream, where as in MappingModeMultiTable mode ( data is ingested to multiple tables ) and UseMultiMeasureRecords is enabled, we ask for measureName(MeasureNameForMultiMeasureRecords) that needs to be used, this is due to the fact that measurementName(line protocol) is used as timestream table name. Hope that clarifies, Readme has some details about different combinations for these configs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nirmeshk Please add any details I might have missed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. It would be good if you can add this explanation as a comment to the code...

Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is still missing.

plugins/outputs/timestream/timestream.go Outdated Show resolved Hide resolved
plugins/outputs/timestream/timestream.go Outdated Show resolved Hide resolved
plugins/outputs/timestream/timestream.go Outdated Show resolved Hide resolved
@srebhan
Copy link
Contributor

srebhan commented Jul 21, 2022

@lohithshetty I think you did not push the changes yet, did you? Let me know once you are ready for another review round...

@lohithshetty
Copy link
Contributor Author

@srebhan I pushed the changes, can you please take a look. Thank you.

@srebhan
Copy link
Contributor

srebhan commented Jul 26, 2022

Hey @lohithshetty thanks for the push. This leaves us with the question on why lines 123 - 126 are different in structure... Can you please comment on this?!

@lohithshetty
Copy link
Contributor Author

Hi @srebhan, would appreciate your help in reviewing and closing this PR. Thank you.

@srebhan
Copy link
Contributor

srebhan commented Aug 16, 2022

@lohithshetty beside my comment, can you please run make docs and push the changes to fix the unit tests!?

Update sample.conf to include new documentation, disabled failing test ( will re-visit with a follow up)
@lohithshetty
Copy link
Contributor Author

Hi @srebhan, Thanks for reviewing the pull request, I've made the changes as per your suggestion. Currently circle-ci failing for mac for plugin plugins/outputs/graylog ( not related to this pull request ). Appreciate merging this changes. Thank you.

@kingston88
Copy link

@srebhan Are we good to merge this change this week?

@kingston88
Copy link

@reimda @srebhan Can we merge this change?

@reimda
Copy link
Contributor

reimda commented Sep 9, 2022

@reimda @srebhan Can we merge this change?

We merge after two review approvals, so it's close. It looks like there is one outstanding item from srebhan's review that needs to be taken care of. Just adding some comments?

@lohithshetty
Copy link
Contributor Author

@reimda @srebhan
README has a section which explains different modes with examples ( refer to Mapping data from Influx to Timestream section in README). Please let me know if you think more explanation/comments are required.

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.

Thanks @lohithshetty for the update! There are some small things here and there, but only formatting mostly. Can you please care for the comment documenting why the structure differs?

plugins/outputs/timestream/README.md Outdated Show resolved Hide resolved
plugins/outputs/timestream/README.md Outdated Show resolved Hide resolved
plugins/outputs/timestream/README.md Outdated Show resolved Hide resolved
Comment on lines 119 to 125
if t.SingleTableDimensionNameForTelegrafMeasurementName != "" {
return fmt.Errorf("in '%s' mapping mode, do not specify SingleTableDimensionNameForTelegrafMeasurementName key", MappingModeMultiTable)
}

if t.UseMultiMeasureRecords && t.MeasureNameForMultiMeasureRecords == "" {
return fmt.Errorf("in '%s' mapping mode, with multi-measure enabled, key MeasureNameForMultiMeasureRecords is required", MappingModeMultiTable)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is still missing.

plugins/outputs/timestream/timestream.go Show resolved Hide resolved
plugins/outputs/timestream/timestream.go Outdated Show resolved Hide resolved
plugins/outputs/timestream/timestream.go Outdated Show resolved Hide resolved
plugins/outputs/timestream/timestream_test.go Outdated Show resolved Hide resolved
plugins/outputs/timestream/timestream_test.go Outdated Show resolved Hide resolved
lohithshetty and others added 10 commits September 16, 2022 12:26
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
linting
linting
linting
linting
@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 decreases the Telegraf binary size by -1.60 % for linux amd64 (new size: 150.2 MB, nightly size 152.6 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_i386.zip
armel.deb armv6hl.rpm freebsd_amd64.tar.gz
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
static_linux_amd64.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 your contribution @lohithshetty!

@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. plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Sep 19, 2022
@srebhan srebhan changed the title feat: support ingesting multi-measures to timestream feat(outputs.timestream): Support ingesting multi-measures Sep 19, 2022
@srebhan srebhan merged commit 8dd7ec0 into influxdata:master Sep 20, 2022
dba-leshop pushed a commit to dba-leshop/telegraf that referenced this pull request Oct 30, 2022
@hadiel05
Copy link

hadiel05 commented Nov 3, 2022

Is this released? tested with this tag telegraf:1.24.3 and seems like its not.

@powersj
Copy link
Contributor

powersj commented Nov 3, 2022

Anything tagged a new "feature" is released in the next minor version. This should go out in v1.25.0

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/output 1. Request for new output plugins 2. Issues/PRs that are related to out 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.

timestream output plugin with multi-measure records
6 participants