Skip to content

Commit 4124b6f

Browse files
ChrsMarkmugund10
andauthored
[kubeletstats] Cleanup deprecated *.cpu.utilization metrics and respective feature gate (#42727)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description After the merge of #41042 we need to completely remove the `receiver.kubeletstats.enableCPUUsageMetrics` feature gate and cleanup the component accordingly. The feature gate has been [in place until v0.131.0](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/41042/files#diff-3d568b694da81fd8cca718ee598c1fa14d20176a73af0f8d009388f5a6c2e11dR33) hence now it can be removed entirely. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #41178 Supersedes #41880. <!--Describe what testing was performed and which tests were added.--> #### Testing Updated <!--Describe the documentation added.--> #### Documentation Updated <!--Please delete paragraphs that you did not use before submitting.--> Co-authored-by: mugund10 <[email protected]> Signed-off-by: ChrsMark <[email protected]> Co-authored-by: mugund10 <[email protected]>
1 parent 3b419dc commit 4124b6f

File tree

14 files changed

+4
-376
lines changed

14 files changed

+4
-376
lines changed

receiver/kubeletstatsreceiver/README.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
The Kubelet Stats Receiver pulls node, pod, container, and volume metrics from the API server on a kubelet
1818
and sends it down the metric pipeline for further processing.
1919

20-
> [!WARNING]
21-
> The `receiver.kubeletstats.enableCPUUsageMetrics` feature gate was moved to stage `Stable`.
22-
> Deprecated metrics cannot be used anymore.
23-
> For more information which metrics are affected see [here](#metrics-deprecation).
24-
2520
## Metrics
2621

2722
Details about the metrics produced by this receiver can be found in [metadata.yaml](./metadata.yaml) with further documentation in [documentation.md](./documentation.md)
@@ -332,24 +327,3 @@ rules:
332327
resources: ["nodes/proxy"]
333328
verbs: ["get"]
334329
```
335-
336-
### Metrics deprecation
337-
338-
The following metrics were deprecated and renamed from version `v0.125.0`:
339-
340-
- `k8s.node.cpu.utilization` (renamed to `k8s.node.cpu.usage`)
341-
- `k8s.pod.cpu.utilization` (renamed to `k8s.pod.cpu.usage`)
342-
- `container.cpu.utilization` (renamed to `container.cpu.usage`)
343-
344-
The above metrics show usage counted in CPUs and it's not a percentage of used resources.
345-
These metrics were previously incorrectly named using the utilization term.
346-
347-
#### `receiver.kubeletstats.enableCPUUsageMetrics` feature gate
348-
349-
- alpha: when enabled it makes the `.cpu.usage` metrics enabled by default, disabling the `.cpu.utilization` metrics
350-
- beta: `.cpu.usage` metrics are enabled by default and any configuration enabling the deprecated `.cpu.utilization` metrics will be failing. Explicitly disabling the feature gate provides the old (deprecated) behavior.
351-
- stable: `.cpu.usage` metrics are enabled by default and the deprecated metrics are completely removed.
352-
- removed three releases after stable.
353-
354-
More information about the deprecation plan and
355-
the background reasoning can be found at <https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/27885>.

receiver/kubeletstatsreceiver/documentation.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,6 @@ metrics:
386386
enabled: true
387387
```
388388
389-
### container.cpu.utilization
390-
391-
Container CPU utilization
392-
393-
| Unit | Metric Type | Value Type |
394-
| ---- | ----------- | ---------- |
395-
| 1 | Gauge | Double |
396-
397389
### container.uptime
398390
399391
The time since the container started
@@ -450,14 +442,6 @@ Container memory utilization as a ratio of the container's requests
450442
| ---- | ----------- | ---------- |
451443
| 1 | Gauge | Double |
452444
453-
### k8s.node.cpu.utilization
454-
455-
Node CPU utilization
456-
457-
| Unit | Metric Type | Value Type |
458-
| ---- | ----------- | ---------- |
459-
| 1 | Gauge | Double |
460-
461445
### k8s.node.uptime
462446
463447
The time since the node started
@@ -474,14 +458,6 @@ Pod cpu utilization as a ratio of the node's capacity
474458
| ---- | ----------- | ---------- |
475459
| 1 | Gauge | Double |
476460
477-
### k8s.pod.cpu.utilization
478-
479-
Pod CPU utilization
480-
481-
| Unit | Metric Type | Value Type |
482-
| ---- | ----------- | ---------- |
483-
| 1 | Gauge | Double |
484-
485461
### k8s.pod.cpu_limit_utilization
486462
487463
Pod cpu utilization as a ratio of the pod's total container limits. If any container is missing a limit the metric is not emitted.

receiver/kubeletstatsreceiver/factory.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"go.opentelemetry.io/collector/component"
1111
"go.opentelemetry.io/collector/consumer"
12-
"go.opentelemetry.io/collector/featuregate"
1312
"go.opentelemetry.io/collector/receiver"
1413
"go.opentelemetry.io/collector/scraper/scraperhelper"
1514
"go.uber.org/zap"
@@ -21,17 +20,7 @@ import (
2120
)
2221

2322
const (
24-
metricGroupsConfig = "metric_groups"
25-
enableCPUUsageMetricsFeatureFlag = "receiver.kubeletstats.enableCPUUsageMetrics"
26-
)
27-
28-
var EnableCPUUsageMetrics = featuregate.GlobalRegistry().MustRegister(
29-
enableCPUUsageMetricsFeatureFlag,
30-
featuregate.StageStable,
31-
featuregate.WithRegisterDescription("When enabled the container.cpu.utilization, k8s.pod.cpu.utilization and k8s.node.cpu.utilization metrics will be replaced by the container.cpu.usage, k8s.pod.cpu.usage and k8s.node.cpu.usage"),
32-
featuregate.WithRegisterFromVersion("v0.110.0"),
33-
featuregate.WithRegisterToVersion("v0.131.0"),
34-
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/27885"),
23+
metricGroupsConfig = "metric_groups"
3524
)
3625

3726
var defaultMetricGroups = []kubelet.MetricGroup{

receiver/kubeletstatsreceiver/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ require (
2020
go.opentelemetry.io/collector/confmap/xconfmap v0.135.1-0.20250911155607-37a3ace6274c
2121
go.opentelemetry.io/collector/consumer v1.41.1-0.20250911155607-37a3ace6274c
2222
go.opentelemetry.io/collector/consumer/consumertest v0.135.1-0.20250911155607-37a3ace6274c
23-
go.opentelemetry.io/collector/featuregate v1.41.1-0.20250911155607-37a3ace6274c
2423
go.opentelemetry.io/collector/filter v0.135.1-0.20250911155607-37a3ace6274c
2524
go.opentelemetry.io/collector/pdata v1.41.1-0.20250911155607-37a3ace6274c
2625
go.opentelemetry.io/collector/pipeline v1.41.1-0.20250911155607-37a3ace6274c
@@ -110,6 +109,7 @@ require (
110109
go.opentelemetry.io/collector/consumer/xconsumer v0.135.1-0.20250911155607-37a3ace6274c // indirect
111110
go.opentelemetry.io/collector/extension/extensionauth v1.41.1-0.20250911155607-37a3ace6274c // indirect
112111
go.opentelemetry.io/collector/extension/extensionmiddleware v0.135.1-0.20250911155607-37a3ace6274c // indirect
112+
go.opentelemetry.io/collector/featuregate v1.41.1-0.20250911155607-37a3ace6274c // indirect
113113
go.opentelemetry.io/collector/internal/sharedcomponent v0.135.1-0.20250911155607-37a3ace6274c // indirect
114114
go.opentelemetry.io/collector/internal/telemetry v0.135.1-0.20250911155607-37a3ace6274c // indirect
115115
go.opentelemetry.io/collector/pdata/pprofile v0.135.1-0.20250911155607-37a3ace6274c // indirect

receiver/kubeletstatsreceiver/internal/kubelet/cpu.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ func addCPUUtilizationMetrics(
3737
r resources,
3838
nodeCPULimit float64,
3939
) {
40-
cpuMetrics.Utilization(mb, currentTime, usageCores)
41-
4240
if nodeCPULimit > 0 {
4341
cpuMetrics.NodeUtilization(mb, currentTime, usageCores/nodeCPULimit)
4442
}

receiver/kubeletstatsreceiver/internal/metadata/generated_config.go

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/kubeletstatsreceiver/internal/metadata/generated_config_test.go

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)