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

out_cloudwatch_logs: auto retry invalid requests #4189

Merged
merged 2 commits into from
Nov 22, 2021

Conversation

PettitWesley
Copy link
Contributor

Signed-off-by: Wesley Pettit [email protected]


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

Documentation

  • Documentation required for this feature

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Comment on lines 1357 to 1364
if (retry == FLB_TRUE) {
flb_plg_debug(ctx->ins, "Recieved code 200 but response was invalid, %s header not found",
AMZN_REQUEST_ID_HEADER);
}
else {
flb_plg_error(ctx->ins, "Recieved code 200 but response was invalid, %s header not found",
AMZN_REQUEST_ID_HEADER);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is confusing. Same behavior and message, one is being treated as debug log and another error type. I think we can remove this check and print a warn. Then if needed when the auto retry fails, we can print another error log before returning -1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so the idea is that we give 1 retry. If the retry is available, then we don't print an error. This prevents the users from seeing lots of errors in their logs that they can't do anything about and then will scare them into thinking something is going wrong. I only want to bring the user's attention to this after the retry fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the retry succeeds, then the plugin was successful, and the user should not be alerted to any error. Hence, no error log in that case.

This is similar to our go plugins which use the AWS SDK go which will silently auto-retry requests IIRC.

Copy link
Contributor

Choose a reason for hiding this comment

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

I unerstand your point. Thats why I suggested maybe we can print an error log only before returning the final -1. Before that we can make them either debug or warn which carries similar values in my opinion. This way we can reduce an extra condition.

Either way you can't reduce the number of logs (debug/error) you are printing, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh I see, you just want me to remove the if else

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea. just keep one log whatever you prfer (debug/warn/error). This way your six lines of code become one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@PettitWesley Is this resolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nokute78 Sorry- fixed it.

@github-actions
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@PettitWesley
Copy link
Contributor Author

@edsiper @nokute78 Can I get approval/merge on this? I can't approve my own PRs...

@PettitWesley PettitWesley requested a review from edsiper November 16, 2021 23:27
Copy link
Collaborator

@nokute78 nokute78 left a comment

Choose a reason for hiding this comment

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

@PettitWesley Thank you for updating.

@nokute78 nokute78 merged commit 10c3cd5 into fluent:master Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants