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 errcheck issue for aws related exporter #9785

Conversation

fatsheep9146
Copy link
Contributor

@fatsheep9146 fatsheep9146 commented May 7, 2022

Signed-off-by: Ziqi Zhao zhaoziqi9146@gmail.com

Description:
fix errcheck and gocritic issue for aws related exporter, awscloudwatchlogsexporter, awsemfexporter, awsxrayexporter

Link to tracking Issue:
#9749 #10466

@fatsheep9146 fatsheep9146 requested a review from a team May 7, 2022 01:16
@fatsheep9146 fatsheep9146 requested a review from Aneurysm9 as a code owner May 7, 2022 01:16
@fatsheep9146
Copy link
Contributor Author

@mx-psi Please help review this pr, thanks :)

@bogdandrutu bogdandrutu assigned Aneurysm9 and unassigned codeboten May 9, 2022
@fatsheep9146
Copy link
Contributor Author

@Aneurysm9 Can you help review this pr?

@pmm-sumo
Copy link
Contributor

I think this should have changelog entry

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Left a couple of comments, but I think we should wait for @Aneurysm9 to be back and have a look at these

Comment on lines 69 to 71
expConfig.Validate()
err = expConfig.Validate()
if err != nil {
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

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

This can go away entirely, validation is already done by the service so this will never fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "service" you mention is cwlogs.NewClient fucntion?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this validation should be able to be removed. It seems overly defensive given that the service hosts will already have validated it.

Comment on lines 85 to 87
expConfig.Validate()
err = expConfig.Validate()
if err != nil {
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@@ -181,7 +180,7 @@ func fillJavaStacktrace(stacktrace string, exceptions []awsxray.Exception) []aws
r := textproto.NewReader(bufio.NewReader(strings.NewReader(stacktrace)))

// Skip first line containing top level exception / message
r.ReadLine()
_, _ = r.ReadLine()
Copy link
Member

Choose a reason for hiding this comment

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

Should we check the error and return exceptions here, the same way it's done when lines are actually read?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, probably. An error here would seem to indicate a failure that should stop further processing.

Copy link
Member

Choose a reason for hiding this comment

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

This still needs to be addressed

@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2022

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jun 7, 2022
@Aneurysm9 Aneurysm9 removed the Stale label Jun 7, 2022
@fatsheep9146 fatsheep9146 force-pushed the fatsheep9146/fix-errcheck-failed-issue branch from 9857e69 to 248b459 Compare June 8, 2022 05:43
@fatsheep9146
Copy link
Contributor Author

@Aneurysm9 @mx-psi I've already fix comments and fix the gocritic failed cases in the mean time.

@djaglowski
Copy link
Member

This appears to need a make gotidy and possibly a rebase as well.

Comment on lines 68 to 71
err = expConfig.Validate()
if err != nil {
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

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

This still needs to be removed

@@ -181,7 +180,7 @@ func fillJavaStacktrace(stacktrace string, exceptions []awsxray.Exception) []aws
r := textproto.NewReader(bufio.NewReader(strings.NewReader(stacktrace)))

// Skip first line containing top level exception / message
r.ReadLine()
_, _ = r.ReadLine()
Copy link
Member

Choose a reason for hiding this comment

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

This still needs to be addressed

@fatsheep9146 fatsheep9146 force-pushed the fatsheep9146/fix-errcheck-failed-issue branch from 248b459 to f362869 Compare June 16, 2022 10:33
@fatsheep9146
Copy link
Contributor Author

fatsheep9146 commented Jun 16, 2022

ping @mx-psi , please help review this again, thanks. :)

@mx-psi mx-psi added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jun 17, 2022
Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

LGTM, but would like @Aneurysm9 to have a final look too

@djaglowski
Copy link
Member

There are some unit tests failing: https://github.com/open-telemetry/opentelemetry-collector-contrib/runs/6918563670?check_suite_focus=true#step:7:202

FAIL github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

Please resolve unit test failures

@fatsheep9146
Copy link
Contributor Author

Please resolve unit test failures

Ok.

fatsheep9146 and others added 4 commits June 19, 2022 21:03
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
fatsheep9146 and others added 3 commits June 19, 2022 21:03
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
@fatsheep9146 fatsheep9146 force-pushed the fatsheep9146/fix-errcheck-failed-issue branch from 91fed70 to 130bc28 Compare June 19, 2022 13:03
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
@fatsheep9146
Copy link
Contributor Author

@djaglowski unit test is fixed, but the check-links failed, but I checked that the failed issues are not related to aws related exporters, should I resolve those in another pr?

@djaglowski
Copy link
Member

Thanks @fatsheep9146. I agree the failure is unrelated. (I've opened #11167 to address it.)

@djaglowski djaglowski merged commit 426c5a9 into open-telemetry:main Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants