From e5f8f6404596a0656fc08350e513a2f5bceef69a Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri-Benedetti Date: Wed, 9 Aug 2023 09:29:24 +0200 Subject: [PATCH 1/6] Improve system.cpu.utilization description --- .../internal/scraper/cpuscraper/metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml index d9cf0d848a6f..931c06718ca9 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml @@ -27,7 +27,7 @@ metrics: system.cpu.utilization: enabled: false - description: Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs. + description: Difference in system.cpu.time since the last measurement per logical CPU, divided by the elapsed time. unit: 1 gauge: value_type: double From e0deb7dbc4865149ac7575c4e508b53abb32ef27 Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri-Benedetti Date: Wed, 9 Aug 2023 15:53:14 +0200 Subject: [PATCH 2/6] Update receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml Co-authored-by: Ryan Fitzpatrick <10867373+rmfitzpatrick@users.noreply.github.com> --- .../internal/scraper/cpuscraper/metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml index 931c06718ca9..17de7eb384a8 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/metadata.yaml @@ -27,7 +27,7 @@ metrics: system.cpu.utilization: enabled: false - description: Difference in system.cpu.time since the last measurement per logical CPU, divided by the elapsed time. + description: Difference in system.cpu.time since the last measurement per logical CPU, divided by the elapsed time (value in interval [0,1]). unit: 1 gauge: value_type: double From ebb80263857bed32973ef114a034cdbb3110e8ee Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri-Benedetti Date: Wed, 9 Aug 2023 17:58:46 +0200 Subject: [PATCH 3/6] Add changelog entry --- .chloggen/main.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 .chloggen/main.yaml diff --git a/.chloggen/main.yaml b/.chloggen/main.yaml new file mode 100755 index 000000000000..eebf126c094a --- /dev/null +++ b/.chloggen/main.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: hostmetricsreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Improved description of the system.cpu.utilization metrics. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [25115] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] From d721008be1542665bda671785dbddcd286d3bc76 Mon Sep 17 00:00:00 2001 From: Dmitrii Anoshin Date: Wed, 9 Aug 2023 10:20:04 -0700 Subject: [PATCH 4/6] Update .chloggen/main.yaml --- .chloggen/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/main.yaml b/.chloggen/main.yaml index eebf126c094a..9d12d838f524 100755 --- a/.chloggen/main.yaml +++ b/.chloggen/main.yaml @@ -24,4 +24,4 @@ subtext: # Include 'user' if the change is relevant to end users. # Include 'api' if there is a change to a library API. # Default: '[user]' -change_logs: [] +change_logs: [user] From eedb1b8b57b55b89f89bad238d6e7f52db2746ca Mon Sep 17 00:00:00 2001 From: Dmitrii Anoshin Date: Wed, 9 Aug 2023 10:33:26 -0700 Subject: [PATCH 5/6] make generate --- .../internal/scraper/cpuscraper/documentation.md | 2 +- .../scraper/cpuscraper/internal/metadata/generated_metrics.go | 2 +- .../cpuscraper/internal/metadata/generated_metrics_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/documentation.md b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/documentation.md index 3a63d7c7e763..61cec80e1b54 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/documentation.md +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/documentation.md @@ -57,7 +57,7 @@ Number of available physical CPUs. ### system.cpu.utilization -Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs. +Difference in system.cpu.time since the last measurement per logical CPU, divided by the elapsed time (value in interval [0,1]). | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata/generated_metrics.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata/generated_metrics.go index 30c62d987d23..fa5eb13ebb96 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata/generated_metrics.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata/generated_metrics.go @@ -227,7 +227,7 @@ type metricSystemCPUUtilization struct { // init fills system.cpu.utilization metric with initial data. func (m *metricSystemCPUUtilization) init() { m.data.SetName("system.cpu.utilization") - m.data.SetDescription("Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs.") + m.data.SetDescription("Difference in system.cpu.time since the last measurement per logical CPU, divided by the elapsed time (value in interval [0,1]).") m.data.SetUnit("1") m.data.SetEmptyGauge() m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata/generated_metrics_test.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata/generated_metrics_test.go index e16a3fa420c5..a4ff5f62baf0 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata/generated_metrics_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata/generated_metrics_test.go @@ -142,7 +142,7 @@ func TestMetricsBuilder(t *testing.T) { validatedMetrics["system.cpu.utilization"] = true assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) - assert.Equal(t, "Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs.", ms.At(i).Description()) + assert.Equal(t, "Difference in system.cpu.time since the last measurement per logical CPU, divided by the elapsed time (value in interval [0,1]).", ms.At(i).Description()) assert.Equal(t, "1", ms.At(i).Unit()) dp := ms.At(i).Gauge().DataPoints().At(0) assert.Equal(t, start, dp.StartTimestamp()) From 4fe883d78767e81c65e33d9ff719ca3a96bdd77e Mon Sep 17 00:00:00 2001 From: Dmitrii Anoshin Date: Wed, 9 Aug 2023 11:04:14 -0700 Subject: [PATCH 6/6] update test --- .../internal/scraper/cpuscraper/cpu_scraper_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go index 1e6be30b5354..6938f578143b 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go @@ -368,7 +368,7 @@ func assertCPUMetricHasLinuxSpecificStateLabels(t *testing.T, metric pmetric.Met func assertCPUUtilizationMetricValid(t *testing.T, metric pmetric.Metric, startTime pcommon.Timestamp) { expected := pmetric.NewMetric() expected.SetName("system.cpu.utilization") - expected.SetDescription("Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs.") + expected.SetDescription("Difference in system.cpu.time since the last measurement per logical CPU, divided by the elapsed time (value in interval [0,1]).") expected.SetUnit("1") expected.SetEmptyGauge() internal.AssertDescriptorEqual(t, expected, metric)