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

Remove errors.Cause() usage from cardinality analysis handler #7214

Merged

Conversation

pracucci
Copy link
Collaborator

What this PR does

In this PR I'm removing errors.Cause() from respondFromError(), which is only used by the cardinality analysis handler. The errors.Cause() was passed to httpgrpc.HTTPResponseFromError() which, in turn, passes the error to grpcutil.ErrorToStatus(). grpcutil.ErrorToStatus() (see code) uses errors.As() (which navigates the chain of wrapped errors), so the errors.Cause() usage should be superfluous.

Note: this PR is part of a work I'm doing to completely remove errors.Cause() from Mimir.

Which issue(s) this PR fixes or relates to

N/A

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci pracucci marked this pull request as ready for review January 25, 2024 11:09
@pracucci pracucci requested a review from a team as a code owner January 25, 2024 11:09
@pracucci pracucci mentioned this pull request Jan 25, 2024
4 tasks
Copy link
Contributor

@narqo narqo 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, overall

(nit) It seems that the import of pkg/errors in this file, can now be replaced with stdlib's error, right?

@pracucci
Copy link
Collaborator Author

(nit) It seems that the import of pkg/errors in this file, can now be replaced with stdlib's error, right?

I think it can, but it's unrelated from work. This work is about not using errors.Cause() because it's incompatible with standard errors package, while we haven't took any decision whether we want to uniform towards standard errors package or not (currently we use a mix of the two in Mimir).

@pracucci pracucci merged commit cb1e54f into main Jan 25, 2024
28 checks passed
@pracucci pracucci deleted the remove-errors-cause-from-cardinality-analysis-handler branch January 25, 2024 15:09
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