Remove cpu_usage_busy, this is simply 100-cpu_usage_idle

This commit is contained in:
Cameron Sparr 2015-09-17 17:37:12 -07:00
parent 0270ace3d4
commit 10b0438201
2 changed files with 2 additions and 5 deletions

View File

@ -78,10 +78,9 @@ func (s *CPUStats) Gather(acc plugins.Accumulator) error {
continue continue
} }
usage_idle := 100 * (cts.Idle - lastCts.Idle) / totalDelta
add(acc, "usage_user", 100*(cts.User-lastCts.User)/totalDelta, tags) add(acc, "usage_user", 100*(cts.User-lastCts.User)/totalDelta, tags)
add(acc, "usage_system", 100*(cts.System-lastCts.System)/totalDelta, tags) add(acc, "usage_system", 100*(cts.System-lastCts.System)/totalDelta, tags)
add(acc, "usage_idle", usage_idle, tags) add(acc, "usage_idle", 100*(cts.Idle-lastCts.Idle)/totalDelta, tags)
add(acc, "usage_nice", 100*(cts.Nice-lastCts.Nice)/totalDelta, tags) add(acc, "usage_nice", 100*(cts.Nice-lastCts.Nice)/totalDelta, tags)
add(acc, "usage_iowait", 100*(cts.Iowait-lastCts.Iowait)/totalDelta, tags) add(acc, "usage_iowait", 100*(cts.Iowait-lastCts.Iowait)/totalDelta, tags)
add(acc, "usage_irq", 100*(cts.Irq-lastCts.Irq)/totalDelta, tags) add(acc, "usage_irq", 100*(cts.Irq-lastCts.Irq)/totalDelta, tags)
@ -89,7 +88,6 @@ func (s *CPUStats) Gather(acc plugins.Accumulator) error {
add(acc, "usage_steal", 100*(cts.Steal-lastCts.Steal)/totalDelta, tags) add(acc, "usage_steal", 100*(cts.Steal-lastCts.Steal)/totalDelta, tags)
add(acc, "usage_guest", 100*(cts.Guest-lastCts.Guest)/totalDelta, tags) add(acc, "usage_guest", 100*(cts.Guest-lastCts.Guest)/totalDelta, tags)
add(acc, "usage_guest_nice", 100*(cts.GuestNice-lastCts.GuestNice)/totalDelta, tags) add(acc, "usage_guest_nice", 100*(cts.GuestNice-lastCts.GuestNice)/totalDelta, tags)
add(acc, "usage_busy", 100.0-usage_idle, tags)
} }

View File

@ -153,7 +153,7 @@ func TestSystemStats_GenerateStats(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
numCPUPoints = len(acc.Points) - (preCPUPoints + numCPUPoints) numCPUPoints = len(acc.Points) - (preCPUPoints + numCPUPoints)
expectedCPUPoints = 21 expectedCPUPoints = 20
assert.Equal(t, numCPUPoints, expectedCPUPoints) assert.Equal(t, numCPUPoints, expectedCPUPoints)
assertContainsTaggedFloat(t, acc, "user", 11.4, 0, cputags) assertContainsTaggedFloat(t, acc, "user", 11.4, 0, cputags)
@ -177,7 +177,6 @@ func TestSystemStats_GenerateStats(t *testing.T) {
assertContainsTaggedFloat(t, acc, "usage_steal", 0.2301, 0.0005, cputags) assertContainsTaggedFloat(t, acc, "usage_steal", 0.2301, 0.0005, cputags)
assertContainsTaggedFloat(t, acc, "usage_guest", 4.8, 0.0005, cputags) assertContainsTaggedFloat(t, acc, "usage_guest", 4.8, 0.0005, cputags)
assertContainsTaggedFloat(t, acc, "usage_guest_nice", 2.2, 0.0005, cputags) assertContainsTaggedFloat(t, acc, "usage_guest_nice", 2.2, 0.0005, cputags)
assertContainsTaggedFloat(t, acc, "usage_busy", 21.2301, 0.0005, cputags)
err = (&DiskStats{&mps}).Gather(&acc) err = (&DiskStats{&mps}).Gather(&acc)
require.NoError(t, err) require.NoError(t, err)