Merge pull request #114201 from Octopusjust/k8s-pr20

change unnecessary `switch` to `if` in metrics.go
This commit is contained in:
Kubernetes Prow Robot 2023-02-16 07:21:38 -08:00 committed by GitHub
commit 9269aaada2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,8 +114,7 @@ func RegisterMetrics() {
func RecordTransformation(transformationType, transformerPrefix string, elapsed time.Duration, err error) {
transformerOperationsTotal.WithLabelValues(transformationType, transformerPrefix, status.Code(err).String()).Inc()
switch {
case err == nil:
if err == nil {
transformerLatencies.WithLabelValues(transformationType, transformerPrefix).Observe(elapsed.Seconds())
}
}