From debae8ead0fcf4e5aaf413d9542420be5a5061af Mon Sep 17 00:00:00 2001 From: Sven Rebhan <36194019+srebhan@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:20:44 +0100 Subject: [PATCH] docs(inputs.cpu): Clarify 'time_active' contains 'iowait' (#14215) --- plugins/inputs/cpu/README.md | 1 + plugins/inputs/cpu/cpu.go | 8 -------- plugins/inputs/cpu/cpu_test.go | 8 ++++++++ plugins/inputs/cpu/sample.conf | 1 + 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/inputs/cpu/README.md b/plugins/inputs/cpu/README.md index f242c408f..0af7f127d 100644 --- a/plugins/inputs/cpu/README.md +++ b/plugins/inputs/cpu/README.md @@ -36,6 +36,7 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details. ## If true, collect raw CPU time metrics collect_cpu_time = false ## If true, compute and report the sum of all non-idle CPU states + ## NOTE: The resulting 'time_active' field INCLUDES 'iowait'! report_active = false ## If true and the info is available then add core_id and physical_id tags core_tags = false diff --git a/plugins/inputs/cpu/cpu.go b/plugins/inputs/cpu/cpu.go index b26a650d3..90cfa2449 100644 --- a/plugins/inputs/cpu/cpu.go +++ b/plugins/inputs/cpu/cpu.go @@ -32,14 +32,6 @@ type CPUStats struct { Log telegraf.Logger `toml:"-"` } -func NewCPUStats(ps system.PS) *CPUStats { - return &CPUStats{ - ps: ps, - CollectCPUTime: true, - ReportActive: true, - } -} - func (*CPUStats) SampleConfig() string { return sampleConfig } diff --git a/plugins/inputs/cpu/cpu_test.go b/plugins/inputs/cpu/cpu_test.go index 62fcd35c1..d91d74ecd 100644 --- a/plugins/inputs/cpu/cpu_test.go +++ b/plugins/inputs/cpu/cpu_test.go @@ -11,6 +11,14 @@ import ( "github.com/influxdata/telegraf/testutil" ) +func NewCPUStats(ps system.PS) *CPUStats { + return &CPUStats{ + ps: ps, + CollectCPUTime: true, + ReportActive: true, + } +} + func TestCPUStats(t *testing.T) { var mps system.MockPS defer mps.AssertExpectations(t) diff --git a/plugins/inputs/cpu/sample.conf b/plugins/inputs/cpu/sample.conf index b0254b95d..9544b2706 100644 --- a/plugins/inputs/cpu/sample.conf +++ b/plugins/inputs/cpu/sample.conf @@ -7,6 +7,7 @@ ## If true, collect raw CPU time metrics collect_cpu_time = false ## If true, compute and report the sum of all non-idle CPU states + ## NOTE: The resulting 'time_active' field INCLUDES 'iowait'! report_active = false ## If true and the info is available then add core_id and physical_id tags core_tags = false