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

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())
}
}