diff --git a/pkg/kubelet/server/stats/volume_stat_calculator.go b/pkg/kubelet/server/stats/volume_stat_calculator.go index f2580e0e679..671c72ca4b5 100644 --- a/pkg/kubelet/server/stats/volume_stat_calculator.go +++ b/pkg/kubelet/server/stats/volume_stat_calculator.go @@ -32,6 +32,7 @@ import ( "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utiltrace "k8s.io/utils/trace" ) // volumeStatCalculator calculates volume metrics for a given pod periodically in the background and caches the result @@ -133,7 +134,11 @@ func (s *volumeStatCalculator) calcAndStoreStats() { var ephemeralStats []stats.VolumeStats var persistentStats []stats.VolumeStats for name, v := range metricVolumes { - metric, err := v.GetMetrics() + metric, err := func() (*volume.Metrics, error) { + trace := utiltrace.New(fmt.Sprintf("Calculate volume metrics of %v for pod %v/%v", name, s.pod.Namespace, s.pod.Name)) + defer trace.LogIfLong(1 * time.Second) + return v.GetMetrics() + }() if err != nil { // Expected for Volumes that don't support Metrics if !volume.IsNotSupported(err) {