Skip to content

Commit

Permalink
fix system disk total val (#835)
Browse files Browse the repository at this point in the history
* fix system disk total val


---------

Co-authored-by: liujiapeng.ljp <liujiapeng.ljp@alibaba-inc.com>
  • Loading branch information
EvanLjp and liujiapeng.ljp authored May 8, 2023
1 parent 126497d commit 03dfa0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ your changes, such as:

## Example

- [public] [both] [fix] do not read env config from exited containers
- [public] [both] [updated] add a new feature

## [Unreleased]
- [public] [both] [fixed] Resolved issue of double counting disk total metrics in the disk partition condition of metric_system_v2
- [public] [both] [fixed] do not read env config from exited containers

8 changes: 8 additions & 0 deletions plugins/input/systemv2/input_system_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ func (r *InputSystem) CollectDisk(collector pipeline.Collector) {
if err == nil {
totalIoCount := disk.IOCountersStat{}
for _, ioCount := range allIoCounters {
if ioCount.Name == "" {
continue
}
lastChar := ioCount.Name[len(ioCount.Name)-1]
if lastChar >= '0' && lastChar <= '9' {
// means disk partition, don't need to record to total metrics
continue
}
totalIoCount.ReadBytes += ioCount.ReadBytes
totalIoCount.WriteBytes += ioCount.WriteBytes
totalIoCount.ReadCount += ioCount.ReadCount
Expand Down

0 comments on commit 03dfa0b

Please sign in to comment.