Skip to content

Commit

Permalink
[receiver/dockerstats] remove deprecated container.cpu.percent and co…
Browse files Browse the repository at this point in the history
…mplete the transition to container.cpu.utilization (open-telemetry#27795)

**Description:** <Describe what has changed.>

Following up open-telemetry#24183, this PR removes the deprecated
`container.cpu.percent` metric as explained in README's [deprecation
section](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/dockerstatsreceiver#transition-to-cpu-utilization-metric-name-aligned-with-opentelemetry-specification).

**Link to tracking Issue:** open-telemetry#21807

**Testing:** <Describe what testing was performed and which tests were
added.>

```
❯ go test -race -timeout 300s -parallel 4 --tags="" ./... -count 1
ok      github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver  1.480s
ok      github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver/internal/metadata        1.525s
```

**Documentation:** the documentation has been updated using `mdatagen`

---------

Co-authored-by: Pablo Baeyens <[email protected]>
  • Loading branch information
2 people authored and jmsnll committed Nov 12, 2023
1 parent 9ae7c96 commit 6a70359
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 111 deletions.
29 changes: 29 additions & 0 deletions .chloggen/remove-deprecated-cpu-metric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use this changelog template to create an entry for release notes.

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

# 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 is removed 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 removed. `container.cpu.utilization` is enabled by default as a replacement.
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).
# 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: [user]
8 changes: 0 additions & 8 deletions receiver/dockerstatsreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,6 @@ 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

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.

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

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ all_set:
enabled: true
container.blockio.sectors_recursive:
enabled: true
container.cpu.percent:
enabled: true
container.cpu.throttling_data.periods:
enabled: true
container.cpu.throttling_data.throttled_periods:
Expand Down Expand Up @@ -168,8 +166,6 @@ none_set:
enabled: false
container.blockio.sectors_recursive:
enabled: false
container.cpu.percent:
enabled: false
container.cpu.throttling_data.periods:
enabled: false
container.cpu.throttling_data.throttled_periods:
Expand Down
13 changes: 0 additions & 13 deletions receiver/dockerstatsreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,6 @@ metrics:
unit: "1"
gauge:
value_type: double
container.cpu.percent:
enabled: false
description: "[DEPRECATED] Use `container.cpu.utilization` metric instead. Percent of CPU used by the container."
unit: "1"
warnings:
if_configured: >-
The metric is deprecated and will be removed in v0.89.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


# Memory
container.memory.usage.limit:
enabled: true
Expand Down
1 change: 0 additions & 1 deletion receiver/dockerstatsreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ func (r *receiver) recordCPUMetrics(now pcommon.Timestamp, cpuStats *dtypes.CPUS
r.mb.RecordContainerCPUThrottlingDataPeriodsDataPoint(now, int64(cpuStats.ThrottlingData.Periods))
r.mb.RecordContainerCPUThrottlingDataThrottledTimeDataPoint(now, int64(cpuStats.ThrottlingData.ThrottledTime))
r.mb.RecordContainerCPUUtilizationDataPoint(now, calculateCPUPercent(prevStats, cpuStats))
r.mb.RecordContainerCPUPercentDataPoint(now, calculateCPUPercent(prevStats, cpuStats))

for coreNum, v := range cpuStats.CPUUsage.PercpuUsage {
r.mb.RecordContainerCPUUsagePercpuDataPoint(now, int64(v), fmt.Sprintf("cpu%s", strconv.Itoa(coreNum)))
Expand Down

0 comments on commit 6a70359

Please sign in to comment.