Merge pull request #98332 from JornShen/combine_volumn_latency_and_error_metrics

combine storage latency and error metrics
This commit is contained in:
Kubernetes Prow Robot 2021-01-25 15:05:00 -08:00 committed by GitHub
commit bb310acad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,16 +47,7 @@ var storageOperationMetric = metrics.NewHistogramVec(
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 10, 15, 25, 50, 120, 300, 600},
StabilityLevel: metrics.ALPHA,
},
[]string{"volume_plugin", "operation_name"},
)
var storageOperationErrorMetric = metrics.NewCounterVec(
&metrics.CounterOpts{
Name: "storage_operation_errors_total",
Help: "Storage operation errors",
StabilityLevel: metrics.ALPHA,
},
[]string{"volume_plugin", "operation_name"},
[]string{"volume_plugin", "operation_name", "status"},
)
var storageOperationStatusMetric = metrics.NewCounterVec(
@ -86,7 +77,6 @@ func registerMetrics() {
// legacyregistry is the internal k8s wrapper around the prometheus
// global registry, used specifically for metric stability enforcement
legacyregistry.MustRegister(storageOperationMetric)
legacyregistry.MustRegister(storageOperationErrorMetric)
legacyregistry.MustRegister(storageOperationStatusMetric)
legacyregistry.MustRegister(storageOperationEndToEndLatencyMetric)
}
@ -102,10 +92,8 @@ func OperationCompleteHook(plugin, operationName string) func(*error) {
// TODO: Establish well-known error codes to be able to distinguish
// user configuration errors from system errors.
status = statusFailUnknown
storageOperationErrorMetric.WithLabelValues(plugin, operationName).Inc()
} else {
storageOperationMetric.WithLabelValues(plugin, operationName).Observe(timeTaken)
}
storageOperationMetric.WithLabelValues(plugin, operationName, status).Observe(timeTaken)
storageOperationStatusMetric.WithLabelValues(plugin, operationName, status).Inc()
}
return opComplete