agent icon indicating copy to clipboard operation
agent copied to clipboard

Chore: Fixes error handling in log exporter

Open vanugrah opened this issue 1 year ago • 8 comments

PR Description

Which issue(s) this PR fixes

The error handling in log_exporter.go for the app_agent_receiver is currently implemented in a way that the err variable gets overridden - hence the only time it will return an error is if there is an issue processing the last event.

This PR addresses introduces error handling to return if any error is encountered during the processing of logs/measurements/exceptions/events by the logs_exporter.

Notes to the Reviewer

I'm not entirely sure what the thought process of the original author was - but my guess is they wanted to do all the processing and only return errors at the end. If that is the case, this PR should be modified to adhere to that intent.

PR Checklist

  • [ ] CHANGELOG.md updated
  • [ ] Documentation added
  • [ ] Tests updated
  • [ ] Config converters updated

vanugrah avatar Jan 27 '24 04:01 vanugrah

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 27 '24 04:01 CLAassistant

@domasx2 I want to double check this doesnt break anything for you all, this causes it to fail on the first exception instead of trying to process everything.

mattdurham avatar Feb 01 '24 15:02 mattdurham

Hey, sorry, missed the notification! I think my original intent here was to continue handling items despite errors. These payloads are generally one shots that are not retried, so the thinking was to handle what we can and drop what we can't, w/o stopping on first failed item.

I'm gonna pass this to @rlankfo though for a look. Not sure how the cliend endpoint deals with this?

domasx2 avatar Feb 05 '24 14:02 domasx2

Based on @domasx2 comments, @vanugrah using the multierrors might be a better solution here. Lets you build an array of errors and then return. We use this library already in quite a few places.

mattdurham avatar Feb 05 '24 14:02 mattdurham

Based on @domasx2 comments, @vanugrah using the multierrors might be a better solution here. Lets you build an array of errors and then return. We use this library already in quite a few places.

I agree with @mattdurham that we should use multierror here. Currently, if exporting one item from the payload fails then it gets logged and the remaining items in the payload are still processed. With this change, we'll fail on the first error and drop remaining data that might have been otherwise successfully processed.

rlankfo avatar Feb 05 '24 17:02 rlankfo

Hey folks - apologies for the delay. Totally support the use of multierrors. Will try to update this PR over the weekend.

vanugrah avatar Feb 14 '24 21:02 vanugrah

This PR has not had any activity in the past 30 days, so the needs-attention label has been added to it. If you do not have enough time to follow up on this PR or you think it's no longer relevant, consider closing it. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your PR will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!

github-actions[bot] avatar Mar 16 '24 00:03 github-actions[bot]

This PR has not had any activity in the past 30 days, so the needs-attention label has been added to it. If you do not have enough time to follow up on this PR or you think it's no longer relevant, consider closing it. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your PR will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!

github-actions[bot] avatar Jun 16 '24 00:06 github-actions[bot]