Add process start time metric

This commit is contained in:
Saikat Roychowdhury
2021-08-04 03:13:39 +00:00
parent 77adc85097
commit 3c216f78bb
2 changed files with 32 additions and 2 deletions

View File

@@ -111,6 +111,9 @@ type MetricsManager interface {
// status - the operation status, if not specified, i.e., status == nil, an
// "Unknown" status of the passed-in operation is assumed.
RecordMetrics(op OperationKey, status OperationStatus, driverName string)
// GetRegistry() returns the metrics.KubeRegistry used by this metrics manager.
GetRegistry() k8smetrics.KubeRegistry
}
// OperationKey is a structure which holds information to
@@ -265,6 +268,7 @@ func (opMgr *operationMetricsManager) recordCancelMetric(val OperationValue, key
func (opMgr *operationMetricsManager) init() {
opMgr.registry = k8smetrics.NewKubeRegistry()
k8smetrics.RegisterProcessStartTime(opMgr.registry.Register)
opMgr.opLatencyMetrics = k8smetrics.NewHistogramVec(
&k8smetrics.HistogramOpts{
Subsystem: subSystem,
@@ -327,6 +331,10 @@ func (opMgr *operationMetricsManager) StartMetricsEndpoint(pattern, addr string,
return srv, nil
}
func (opMgr *operationMetricsManager) GetRegistry() k8smetrics.KubeRegistry {
return opMgr.registry
}
// snapshotProvisionType represents which kind of snapshot a metric is
type snapshotProvisionType string