Skip to content

Commit

Permalink
Don't make a copy of the PartitionStat struct when iterating over par…
Browse files Browse the repository at this point in the history
…titions
  • Loading branch information
reimda committed Feb 18, 2022
1 parent 61b026a commit a99bc34
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/inputs/system/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ func (s *SystemPS) DiskUsage(
var partitions []*disk.PartitionStat
hostMountPrefix := s.OSGetenv("HOST_MOUNT_PREFIX")

for _, p := range parts {
for i := range parts {
p := parts[i]

// If there is a filter set and if the mount point is not a
// member of the filter set, don't gather info on it.
if !mountPointFilterSet.empty() && !mountPointFilterSet.has(p.Mountpoint) {
Expand Down

0 comments on commit a99bc34

Please sign in to comment.