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

[Chore][Log] Delete error loggings right before returned errors #2103

Conversation

MortalHappiness
Copy link
Member

Why are these changes needed?

Based on the What not to Log section in the logging guidelines, we should not log errors inside functions that return errors.
Therefore, in this PR all error loggings right before the returned errors are deleted.

Related issue number

N/A

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@MortalHappiness MortalHappiness force-pushed the feature/delete-error-log-before-return branch from a4249e8 to 542abfa Compare April 25, 2024 19:35
@kevin85421 kevin85421 self-requested a review April 25, 2024 22:51
@kevin85421 kevin85421 self-assigned this Apr 25, 2024
@@ -925,7 +920,6 @@ func (r *RayClusterReconciler) createHeadIngress(ctx context.Context, ingress *n
logger.Info("Ingress already exists, no need to create")
return nil
}
logger.Error(err, "Ingress create error!", "Ingress.Error", err)
Copy link
Collaborator

@andrewsykim andrewsykim Apr 30, 2024

Choose a reason for hiding this comment

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

Agreed it's redundant to both log and return an error. Wondering if we should at least wrap the errors though for better debugability:

return fmt.Errorf("error creating ingress: %w, err")

@MortalHappiness MortalHappiness marked this pull request as draft May 1, 2024 04:26
@MortalHappiness MortalHappiness force-pushed the feature/delete-error-log-before-return branch from 542abfa to 0ce67f3 Compare May 1, 2024 10:13
@MortalHappiness MortalHappiness marked this pull request as ready for review May 1, 2024 10:50
@MortalHappiness MortalHappiness force-pushed the feature/delete-error-log-before-return branch from 0ce67f3 to 6cdc87d Compare May 1, 2024 10:51
@MortalHappiness MortalHappiness force-pushed the feature/delete-error-log-before-return branch from 6cdc87d to f6d07e0 Compare May 8, 2024 13:52
Copy link
Member

@kevin85421 kevin85421 left a comment

Choose a reason for hiding this comment

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

Nice!

@kevin85421 kevin85421 merged commit 784b7f3 into ray-project:master May 9, 2024
24 checks passed
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