Skip to content

Update cpu resource metrics to handle resize#3559

Merged
joaopgrassi merged 9 commits intoopen-telemetry:mainfrom
jmmcorreia:k8s_container_cpu_metrics
Apr 20, 2026
Merged

Update cpu resource metrics to handle resize#3559
joaopgrassi merged 9 commits intoopen-telemetry:mainfrom
jmmcorreia:k8s_container_cpu_metrics

Conversation

@jmmcorreia
Copy link
Copy Markdown
Contributor

Related to #3558

Changes

Modifies the k8s container limit and request metrics to align with resize of CPU metrics as documented in https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/

It fixes the CPU part related to issue #3558. Memory metrics can be fixed in a follow-up PR based on the comments provided for the CPU section

For more details check issue

Merge requirement checklist #3558

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

@ChrsMark ChrsMark moved this to In Review in K8s SemConv SIG Mar 19, 2026
@ChrsMark ChrsMark moved this from Untriaged to Awaiting codeowners approval in Semantic Conventions Triage Mar 19, 2026
Copy link
Copy Markdown
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank's for digging into this @jmmcorreia! I left some comments but overall I think it goes to right direction!

@open-telemetry/semconv-k8s-approvers PTAL

Comment thread docs/non-normative/k8s-migration.md Outdated
Comment thread model/k8s/metrics.yaml Outdated
Comment thread model/k8s/metrics.yaml Outdated
Comment thread model/k8s/metrics.yaml Outdated
Comment thread model/k8s/metrics.yaml Outdated
Comment thread model/k8s/metrics.yaml
jmmcorreia and others added 2 commits March 19, 2026 17:35
Co-authored-by: Christos Markou <chrismarkou92@gmail.com>
@dashpole
Copy link
Copy Markdown
Contributor

dashpole commented Mar 24, 2026

I have a few hesitations with this:

  • As a user, it isn't nearly as obvious what I should be comparing my CPU and memory usage to. The desired or the actual requests/limits? (answer: actual)
  • Desired requests/limits are largely going to be a niche metric to diagnose in-place update issues. We could even consider making it opt-in, IMO.

Did we consider something more like k8s.container.cpu.limit vs k8s.container.cpu.desired_limit?

@jmmcorreia
Copy link
Copy Markdown
Contributor Author

I have a few hesitations with this:

  • As a user, it isn't nearly as obvious what I should be comparing my CPU and memory usage to. The desired or the actual requests/limits? (answer: actual)

Agreed. The utilization metrics does attempt to make that easier on users by making comparison on the collector side and providing the presentation metric to them.

  • Desired requests/limits are largely going to be a niche metric to diagnose in-place update issues. We could even consider making it opt-in, IMO.

That is a valid point, I think it makes sense. Probably a lot of users might not attempt to patch the container resources whilst it is running.

Did we consider something more like k8s.container.cpu.limit vs k8s.container.cpu.desired_limit?

Before raising the PR I was stuck on deciding between the implemented approach (i.e. limit.actual and limit.desired) or going with what you proposed. Had a short discussion with @ChrsMark, and going with limit.actual and limit.desired seemed to fit more the semantic conventions approach of creating a namespace for values that fall under a sort of similar category (i.e. going with . instead of _). What I link from your proposal is that I believe it makes things somewhat simpler for users. We give a clear definition on limit and then only the desired limit (that we are making opt-in anyway) uses the _ separator in the name. However, the current approach was picked as it seems to containerize values a little better as it also includes utilization under the limit. Most likely there will be no need to add more values related to the limit, but if it were, the current approach also make that more flexible. IMO both could work, I think I slightly prefer the current approach given the better containerization of the values and I believe this should help prevent any changes to the metrics in the future in case any new ones have to be added (even if not that likely).

@dashpole But happy yo hear your thoughts on this. @ChrsMark if you have any other comments or anything to add I guess that could be helpful.

@dashpole
Copy link
Copy Markdown
Contributor

The point about utilization is a good one. I think maybe switching to current from actual will mostly address my concerns. I reopened the comment thread above.

Comment thread docs/non-normative/k8s-migration.md Outdated
Comment thread docs/system/k8s-metrics.md
Comment thread model/k8s/metrics.yaml Outdated
Comment thread model/k8s/metrics.yaml Outdated
Comment thread docs/non-normative/k8s-migration.md
Copy link
Copy Markdown
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank's @jmmcorreia!

@lmolkova lmolkova moved this from Awaiting codeowners approval to Needs More Approval in Semantic Conventions Triage Apr 6, 2026
@ChrsMark
Copy link
Copy Markdown
Member

ChrsMark commented Apr 8, 2026

@open-telemetry/semconv-k8s-approvers @open-telemetry/specs-semconv-approvers PTAL

@ChrsMark ChrsMark moved this from In Review to Approved by K8s SIG in K8s SemConv SIG Apr 20, 2026
@ChrsMark
Copy link
Copy Markdown
Member

@open-telemetry/specs-semconv-maintainers this one is approved by the K8s SIG. PTAL

@joaopgrassi joaopgrassi moved this from Needs More Approval to Ready to be Merged in Semantic Conventions Triage Apr 20, 2026
@joaopgrassi joaopgrassi added this pull request to the merge queue Apr 20, 2026
Merged via the queue into open-telemetry:main with commit baa360b Apr 20, 2026
18 checks passed
@github-project-automation github-project-automation bot moved this from Approved by K8s SIG to Done in K8s SemConv SIG Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:k8s enhancement New feature or request

Projects

Status: Done
Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants