From 8d372668b6076f25262b964561bd9295619bbf31 Mon Sep 17 00:00:00 2001 From: James Moessis Date: Wed, 28 Sep 2022 11:59:02 +1000 Subject: [PATCH 1/2] expand description for container.cpu.usage.system --- receiver/dockerstatsreceiver/documentation.md | 2 +- .../internal/metadata/generated_metrics.go | 4 ++-- receiver/dockerstatsreceiver/metadata.yaml | 5 +++-- .../testdata/mock/single_container/expected_metrics.json | 2 +- .../testdata/mock/two_containers/expected_metrics.json | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/receiver/dockerstatsreceiver/documentation.md b/receiver/dockerstatsreceiver/documentation.md index 85780820ab706..41dab684c4391 100644 --- a/receiver/dockerstatsreceiver/documentation.md +++ b/receiver/dockerstatsreceiver/documentation.md @@ -22,7 +22,7 @@ These are the metrics available for this scraper. | container.cpu.throttling_data.throttled_time | Aggregate time the container was throttled. | ns | Sum(Int) | | | **container.cpu.usage.kernelmode** | Time spent by tasks of the cgroup in kernel mode (Linux). Time spent by all container processes in kernel mode (Windows). | ns | Sum(Int) | | | container.cpu.usage.percpu | Per-core CPU usage by the container. | ns | Sum(Int) | | -| **container.cpu.usage.system** | System CPU usage. | ns | Sum(Int) | | +| container.cpu.usage.system | System CPU usage, as reported by docker. Note this is the usage for the system, not the container. | ns | Sum(Int) | | | **container.cpu.usage.total** | Total CPU time consumed. | ns | Sum(Int) | | | **container.cpu.usage.usermode** | Time spent by tasks of the cgroup in user mode (Linux). Time spent by all container processes in user mode (Windows). | ns | Sum(Int) | | | container.memory.active_anon | The amount of anonymous memory that has been identified as active by the kernel. | By | Sum(Int) | | diff --git a/receiver/dockerstatsreceiver/internal/metadata/generated_metrics.go b/receiver/dockerstatsreceiver/internal/metadata/generated_metrics.go index 14a35c1489848..d8e35fdaacf04 100644 --- a/receiver/dockerstatsreceiver/internal/metadata/generated_metrics.go +++ b/receiver/dockerstatsreceiver/internal/metadata/generated_metrics.go @@ -128,7 +128,7 @@ func DefaultMetricsSettings() MetricsSettings { Enabled: false, }, ContainerCPUUsageSystem: MetricSettings{ - Enabled: true, + Enabled: false, }, ContainerCPUUsageTotal: MetricSettings{ Enabled: true, @@ -1032,7 +1032,7 @@ type metricContainerCPUUsageSystem struct { // init fills container.cpu.usage.system metric with initial data. func (m *metricContainerCPUUsageSystem) init() { m.data.SetName("container.cpu.usage.system") - m.data.SetDescription("System CPU usage.") + m.data.SetDescription("System CPU usage, as reported by docker.") m.data.SetUnit("ns") m.data.SetEmptySum() m.data.Sum().SetIsMonotonic(true) diff --git a/receiver/dockerstatsreceiver/metadata.yaml b/receiver/dockerstatsreceiver/metadata.yaml index 6a8601a6038d6..801eb17b11b37 100644 --- a/receiver/dockerstatsreceiver/metadata.yaml +++ b/receiver/dockerstatsreceiver/metadata.yaml @@ -40,8 +40,9 @@ attributes: metrics: # CPU container.cpu.usage.system: - enabled: true - description: "System CPU usage." + enabled: false + description: "System CPU usage, as reported by docker." + extended_documentation: "Note this is the usage for the system, not the container." unit: ns sum: value_type: int diff --git a/receiver/dockerstatsreceiver/testdata/mock/single_container/expected_metrics.json b/receiver/dockerstatsreceiver/testdata/mock/single_container/expected_metrics.json index cdb10806751b0..52b62ac518d68 100644 --- a/receiver/dockerstatsreceiver/testdata/mock/single_container/expected_metrics.json +++ b/receiver/dockerstatsreceiver/testdata/mock/single_container/expected_metrics.json @@ -374,7 +374,7 @@ "unit": "{operations}" }, { - "description": "System CPU usage.", + "description": "System CPU usage, as reported by docker.", "name": "container.cpu.usage.system", "sum": { "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", diff --git a/receiver/dockerstatsreceiver/testdata/mock/two_containers/expected_metrics.json b/receiver/dockerstatsreceiver/testdata/mock/two_containers/expected_metrics.json index d887be7ee30d7..9b9fec92eecfe 100644 --- a/receiver/dockerstatsreceiver/testdata/mock/two_containers/expected_metrics.json +++ b/receiver/dockerstatsreceiver/testdata/mock/two_containers/expected_metrics.json @@ -374,7 +374,7 @@ "unit": "{operations}" }, { - "description": "System CPU usage.", + "description": "System CPU usage, as reported by docker.", "name": "container.cpu.usage.system", "sum": { "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", @@ -1591,7 +1591,7 @@ "unit": "{operations}" }, { - "description": "System CPU usage.", + "description": "System CPU usage, as reported by docker.", "name": "container.cpu.usage.system", "sum": { "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", From f9e2bcb214ddb8dddf2ffbfb7d69a3fbc440b404 Mon Sep 17 00:00:00 2001 From: James Moessis Date: Wed, 28 Sep 2022 12:19:00 +1000 Subject: [PATCH 2/2] add changelog --- unreleased/system-usage-tweak.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 unreleased/system-usage-tweak.yaml diff --git a/unreleased/system-usage-tweak.yaml b/unreleased/system-usage-tweak.yaml new file mode 100755 index 0000000000000..62348afaaccb3 --- /dev/null +++ b/unreleased/system-usage-tweak.yaml @@ -0,0 +1,5 @@ +change_type: breaking +component: dockerstatsreceiver +note: "`container.cpu.usage.system` is no longer a default metric. Added more description for the metric." +issues: [9794, 14558] +subtext: "Change is not breaking unless you are have enabled the featuregate `receiver.dockerstats.useScraperV2` and are using the specified metric."