Restore volume operation error metric, and mark it and related metric for deprecation

Change-Id: I3f559e34637c28999ee9e708a832e16b1764887d
This commit is contained in:
Matthew Cary 2021-02-12 14:21:24 -08:00
parent 924e3b9db3
commit 3e9cf26f11

View File

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