@@ -347,23 +347,25 @@ func Register(factory info.MachineInfoFactory, fsInfo fs.FsInfo, includedMetrics
347
347
var (
348
348
thinPoolWatcher * devicemapper.ThinPoolWatcher
349
349
thinPoolName string
350
+ zfsWatcher * zfs.ZfsWatcher
350
351
)
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
+ }
356
358
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
+ }
361
363
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
+ }
367
369
}
368
370
}
369
371
0 commit comments