change unnecessary switch to if in metrics.go

This commit is contained in:
ZhangYu 2022-11-30 11:04:03 +08:00
parent 1e84987bac
commit 48b9f7bb6c

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