Merge pull request #1688 from zmyzheng/zmyzheng/fix-IOCountersWithContext

fix(IOCountersWithContext): Fix the issue of not using names to fil ter devices in func IOCountersWithContext of the windows implementation
pull/1464/merge
shirou 9 months ago committed by GitHub
commit edff3add94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -218,6 +218,8 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
if err != nil { if err != nil {
return drivemap, err return drivemap, err
} }
if len(names) == 0 || common.StringsHas(names, path) {
drivemap[path] = IOCountersStat{ drivemap[path] = IOCountersStat{
ReadBytes: uint64(diskPerformance.BytesRead), ReadBytes: uint64(diskPerformance.BytesRead),
WriteBytes: uint64(diskPerformance.BytesWritten), WriteBytes: uint64(diskPerformance.BytesWritten),
@ -229,6 +231,7 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
} }
} }
} }
}
return drivemap, nil return drivemap, nil
} }

Loading…
Cancel
Save