-
Notifications
You must be signed in to change notification settings - Fork 145
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
[WIP] Make defer RecordOperationErrorMetrics always report the correct error code #1712
base: master
Are you sure you want to change the base?
Conversation
…error code is recorded instead of internal error code
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amacaskill The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@amacaskill: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Currently, we rely on gceCS.Metrics.RecordOperationErrorMetrics within a defer call to record error codes to the pdcsi operation error metric. We define this at the beginning of each CSI Call, but this only works if we reassign the error (err) before returning from the CSI call (CreateVolume).
Issue 1
In lots of places, we do not reassign createVolErr, and just return errors directly. This leads to a nil error being reported to RecordOperationErrorMetrics, which makes us report this error as a success (status OK) to the pdcsi operation error metric.
Issue 2
In some places we do something like the following. We call a function (validateVolumeCapabilities) that returns an error that doesn't specify an error code. Inline, we add on an InvalidArgument error code to the error, and return without reassigning the error. This leads to the error without the error code being reported to RecordOperationErrorMetrics, which will count as an Internal error code, when we clearly meant for it to be an InvalidArgument error code.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: