Skip to content

Commit

Permalink
Exclude IOWait time from the CPU total
Browse files Browse the repository at this point in the history
This affects the following two metrics:

* `system.cpu.total.pct`
* `system.cpu.total.norm.pct`

Fixes #7627.
  • Loading branch information
tsg committed Jul 24, 2018
1 parent bfe4c11 commit 7653ac5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ https://github.com/elastic/beats/compare/v6.2.3...master[Check the HEAD diff]
- Change http/server metricset to put events by default under http.server and prefix config options with server.. {pull}7100[7100]
- Disable dedotting in docker module configuration. This will change the out-of-the-box behaviour, but not the one of already configured instances. {pull}7485[7485]
- Fix typo in etcd/self metricset fields from *.bandwithrate to *.bandwidthrate. {pull}7456[7456]
- Changed the definition of the `system.cpu.total.pct` and `system.cpu.total.norm.cou` fields to exclude the IOWait time. {pull}7691[7691]

*Packetbeat*

Expand Down
3 changes: 2 additions & 1 deletion libbeat/metric/system/cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ func cpuPercentages(s0, s1 *sigar.Cpu, numCPU int) Percentages {
}

calculateTotalPct := func() float64 {
return common.Round(float64(numCPU)-calculatePct(s0.Idle, s1.Idle), common.DefaultDecimalPlacesCount)
idle := calculatePct(s0.Idle, s1.Idle) + calculatePct(s0.Wait, s1.Wait)
return common.Round(float64(numCPU)-idle, common.DefaultDecimalPlacesCount)
}

return Percentages{
Expand Down
14 changes: 2 additions & 12 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15459,7 +15459,7 @@ type: scaled_float
format: percent
The percentage of CPU time spent in non-idle state.
The percentage of CPU time spent in states other than Idle and IOWait.
--
Expand Down Expand Up @@ -15567,17 +15567,7 @@ type: scaled_float
format: percent
The percentage of CPU time spent in non-idle state.
--
*`system.cpu.total.value`*::
+
--
type: long
The value of CPU usage since starting the process.
The percentage of CPU time in states other than Idle and IOWait, normalised by the number of cores.
--
Expand Down
11 changes: 2 additions & 9 deletions metricbeat/module/system/cpu/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
type: scaled_float
format: percent
description: >
The percentage of CPU time spent in non-idle state.
The percentage of CPU time spent in states other than Idle and IOWait.
# Normalized Percentages
- name: user.norm.pct
Expand Down Expand Up @@ -126,14 +126,7 @@
type: scaled_float
format: percent
description: >
The percentage of CPU time spent in non-idle state.
# Total
- name: total.value
type: long
description: >
The value of CPU usage since starting the process.
The percentage of CPU time in states other than Idle and IOWait, normalised by the number of cores.
# Ticks
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/system/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7653ac5

Please sign in to comment.