Skip to content

Commit

Permalink
[receiver/dockerstats] Disable deprecated cpu metric (open-telemetry#…
Browse files Browse the repository at this point in the history
…24183)

2nd step for the deprecation of `container.cpu.percent`

According to the deprecation plan in the
[docs](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.79.0/receiver/dockerstatsreceiver#transition-to-cpu-utilization-metric-name-aligned-with-opentelemetry-specification),
this PR disables the old metric by default, to be released in v0.83.0

tracking issue:
open-telemetry#21807

---------

Co-authored-by: Christian <[email protected]>
  • Loading branch information
carlossscastro and sigilioso authored Oct 13, 2023
1 parent 1a2f79a commit cc38768
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 98 deletions.
23 changes: 23 additions & 0 deletions .chloggen/disable_deprecated_cpu_metric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use this changelog template to create an entry for release notes.
# If your change doesn't affect end users, such as a test fix or a tooling change,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: deprecation

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: dockerstatsreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "cpu.container.percent metric will be deprecated in v0.79.0 in favor of container.cpu.utilization"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [21807]

# (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: |
The metric `container.cpu.percentage` is now disabled by default and will be removed in v0.88.0.
As a replacement, the following metric is now enabled by default: `container.cpu.utilization`.
For details, see the [docs](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/dockerstatsreceiver#transition-to-cpu-utilization-metric-name-aligned-with-opentelemetry-specification).
6 changes: 3 additions & 3 deletions receiver/dockerstatsreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ which defines [container.cpu.utilization] as the name for this metric.
To align the emitted metric names with the OpenTelemetry specification,
the following process will be followed to phase out the old metrics:
- Between `v0.79.0` and `v0.81.0`, the new metric is introduced and the old metric is marked as deprecated.
- Between `v0.79.0` and `v0.86.0`, the new metric is introduced and the old metric is marked as deprecated.
Only the old metric are emitted by default.
- Between `v0.82.0` and `v0.84.0`, the old metric is disabled and the new one enabled by default.
- In `v0.85.0` and up, the old metric is removed.
- In `v0.87.0`, the old metric is disabled and the new one enabled by default.
- In `v0.88.0` and up, the old metric is removed.

To change the enabled state for the specific metrics, use the standard configuration options that are available for all metrics.

Expand Down
32 changes: 16 additions & 16 deletions receiver/dockerstatsreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ More docs for [cgroups v1](https://www.kernel.org/doc/Documentation/cgroup-v1/bl
| device_minor | Device minor number for block IO operations. | Any Str |
| operation | Type of BlockIO operation. | Any Str |
### container.cpu.percent
Deprecated: use `container.cpu.utilization` metric instead. Percent of CPU used by the container.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

### 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).
Expand All @@ -62,6 +54,14 @@ Time spent by tasks of the cgroup in user mode (Linux). Time spent by all conta
| ---- | ----------- | ---------- | ----------------------- | --------- |
| ns | Sum | Int | Cumulative | true |
### container.cpu.utilization
Percent of CPU used by the container.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |
### container.memory.file
Amount of memory used to cache filesystem data, including tmpfs and shared memory (Only available with cgroups v2).
Expand Down Expand Up @@ -296,6 +296,14 @@ Number of sectors transferred to/from disk by the group and descendant groups (O
| device_minor | Device minor number for block IO operations. | Any Str |
| operation | Type of BlockIO operation. | Any Str |
### container.cpu.percent
[DEPRECATED] Use `container.cpu.utilization` metric instead. Percent of CPU used by the container.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

### container.cpu.throttling_data.periods

Number of periods with throttling active.
Expand Down Expand Up @@ -344,14 +352,6 @@ Note this is the usage for the system, not the container.
| ---- | ----------- | ---------- | ----------------------- | --------- |
| ns | Sum | Int | Cumulative | true |

### container.cpu.utilization

Percent of CPU used by the container.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

### container.memory.active_anon

The amount of anonymous memory that has been identified as active by the kernel.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions receiver/dockerstatsreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,20 @@ metrics:
monotonic: true
aggregation_temporality: cumulative
container.cpu.utilization:
enabled: false
enabled: true
description: "Percent of CPU used by the container."
unit: "1"
warnings:
if_enabled_not_set: This metric will be enabled by default in v0.82.0.
gauge:
value_type: double
container.cpu.percent:
enabled: true
description: "Deprecated: use `container.cpu.utilization` metric instead. Percent of CPU used by the container."
enabled: false
description: "[DEPRECATED] Use `container.cpu.utilization` metric instead. Percent of CPU used by the container."
unit: "1"
warnings:
if_enabled: This metric will be disabled in v0.82.0 and removed in v0.85.0.
if_configured: >-
The metric is deprecated and will be removed in v0.88.0. Please use `container.cpu.utilization` instead. See
https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/dockerstatsreceiver#transition-to-cpu-utilization-metric-name-aligned-with-opentelemetry-specification
for more details.
gauge:
value_type: double

Expand Down
2 changes: 1 addition & 1 deletion receiver/dockerstatsreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
ContainerBlockioIoTimeRecursive: metricEnabled,
ContainerBlockioIoWaitTimeRecursive: metricEnabled,
ContainerBlockioSectorsRecursive: metricEnabled,
ContainerCPUPercent: metricEnabled,
ContainerCPUUtilization: metricEnabled,
ContainerCPUThrottlingDataPeriods: metricEnabled,
ContainerCPUThrottlingDataThrottledPeriods: metricEnabled,
ContainerCPUThrottlingDataThrottledTime: metricEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: By
- description: 'Deprecated: use `container.cpu.utilization` metric instead. Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0.041326615629205886
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
name: container.cpu.percent
unit: "1"
- description: Number of periods with throttling active.
name: container.cpu.throttling_data.periods
sum:
Expand Down Expand Up @@ -130,6 +122,14 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: ns
- description: 'Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0.041326615629205886
startTimeUnixNano: "1687762436307743000"
timeUnixNano: "1687762436315926000"
name: container.cpu.utilization
unit: "1"
- description: The amount of anonymous memory that has been identified as active by the kernel.
name: container.memory.active_anon
sum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,6 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: '{operations}'
- description: 'Deprecated: use `container.cpu.utilization` metric instead. Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0.0002888012543185477
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
name: container.cpu.percent
unit: "1"
- description: Number of periods with throttling active.
name: container.cpu.throttling_data.periods
sum:
Expand Down Expand Up @@ -336,6 +328,14 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: ns
- description: 'Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0.0002888012543185477
startTimeUnixNano: "1687762436220246000"
timeUnixNano: "1687762436230155000"
name: container.cpu.utilization
unit: "1"
- description: The amount of anonymous memory that has been identified as active by the kernel.
name: container.memory.active_anon
sum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: By
- description: 'Deprecated: use `container.cpu.utilization` metric instead. Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
name: container.cpu.percent
unit: "1"
- description: Number of periods with throttling active.
name: container.cpu.throttling_data.periods
sum:
Expand Down Expand Up @@ -182,6 +174,14 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: ns
- description: 'Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0
startTimeUnixNano: "1687762436274253000"
timeUnixNano: "1687762436282542000"
name: container.cpu.utilization
unit: "1"
- description: The amount of anonymous memory that has been identified as active by the kernel.
name: container.memory.active_anon
sum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,6 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: '{operations}'
- description: 'Deprecated: use `container.cpu.utilization` metric instead. Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0.0002888012543185477
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
name: container.cpu.percent
unit: "1"
- description: Number of periods with throttling active.
name: container.cpu.throttling_data.periods
sum:
Expand Down Expand Up @@ -342,6 +334,14 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: ns
- description: 'Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0.0002888012543185477
startTimeUnixNano: "1687762436059456000"
timeUnixNano: "1687762436071484000"
name: container.cpu.utilization
unit: "1"
- description: The amount of anonymous memory that has been identified as active by the kernel.
name: container.memory.active_anon
sum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,6 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: '{operations}'
- description: 'Deprecated: use `container.cpu.utilization` metric instead. Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0.0002888012543185477
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
name: container.cpu.percent
unit: "1"
- description: Number of periods with throttling active.
name: container.cpu.throttling_data.periods
sum:
Expand Down Expand Up @@ -342,6 +334,14 @@ resourceMetrics:
timeUnixNano: "2000000"
isMonotonic: true
unit: ns
- description: 'Percent of CPU used by the container.'
gauge:
dataPoints:
- asDouble: 0.0002888012543185477
startTimeUnixNano: "1687762436337809000"
timeUnixNano: "1687762436345613000"
name: container.cpu.utilization
unit: "1"
- description: The amount of anonymous memory that has been identified as active by the kernel.
name: container.memory.active_anon
sum:
Expand Down
Loading

0 comments on commit cc38768

Please sign in to comment.