Merge pull request #107006 from gnufied/add-total-mount-time-metrics

Add metric for reporting total end-to-end mount time
This commit is contained in:
Kubernetes Prow Robot
2022-01-07 06:19:31 -08:00
committed by GitHub
3 changed files with 19 additions and 0 deletions

View File

@@ -388,6 +388,9 @@ type VolumeToMount struct {
// DesiredSizeLimit indicates the desired upper bound on the size of the volume
// (if so implemented)
DesiredSizeLimit *resource.Quantity
// time at which volume was requested to be mounted
MountRequestTime time.Time
}
// DeviceMountState represents device mount state in a global path.

View File

@@ -778,6 +778,12 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
}
}
// record total time it takes to mount a volume. This is end to end time that includes waiting for volume to attach, node to be update
// plugin call to succeed
mountRequestTime := volumeToMount.MountRequestTime
totalTimeTaken := time.Since(mountRequestTime).Seconds()
util.RecordOperationLatencyMetric(util.GetFullQualifiedPluginNameForVolume(volumePluginName, volumeToMount.VolumeSpec), "overall_volume_mount", totalTimeTaken)
markVolMountedErr := actualStateOfWorld.MarkVolumeAsMounted(markOpts)
if markVolMountedErr != nil {
// On failure, return error. Caller will log and retry.