@@ -347,23 +347,25 @@ func Register(factory info.MachineInfoFactory, fsInfo fs.FsInfo, includedMetrics
347347 var (
348348 thinPoolWatcher * devicemapper.ThinPoolWatcher
349349 thinPoolName string
350+ zfsWatcher * zfs.ZfsWatcher
350351 )
351- if storageDriver (dockerInfo .Driver ) == devicemapperStorageDriver {
352- thinPoolWatcher , err = startThinPoolWatcher (dockerInfo )
353- if err != nil {
354- klog .Errorf ("devicemapper filesystem stats will not be reported: %v" , err )
355- }
352+ if includedMetrics .Has (container .DiskUsageMetrics ) {
353+ if storageDriver (dockerInfo .Driver ) == devicemapperStorageDriver {
354+ thinPoolWatcher , err = startThinPoolWatcher (dockerInfo )
355+ if err != nil {
356+ klog .Errorf ("devicemapper filesystem stats will not be reported: %v" , err )
357+ }
356358
357- // Safe to ignore error - driver status should always be populated.
358- status , _ := StatusFromDockerInfo (* dockerInfo )
359- thinPoolName = status .DriverStatus [dockerutil .DriverStatusPoolName ]
360- }
359+ // Safe to ignore error - driver status should always be populated.
360+ status , _ := StatusFromDockerInfo (* dockerInfo )
361+ thinPoolName = status .DriverStatus [dockerutil .DriverStatusPoolName ]
362+ }
361363
362- var zfsWatcher * zfs. ZfsWatcher
363- if storageDriver ( dockerInfo . Driver ) == zfsStorageDriver {
364- zfsWatcher , err = startZfsWatcher ( dockerInfo )
365- if err != nil {
366- klog . Errorf ( "zfs filesystem stats will not be reported: %v" , err )
364+ if storageDriver ( dockerInfo . Driver ) == zfsStorageDriver {
365+ zfsWatcher , err = startZfsWatcher ( dockerInfo )
366+ if err != nil {
367+ klog . Errorf ( "zfs filesystem stats will not be reported: %v" , err )
368+ }
367369 }
368370 }
369371
0 commit comments