Skip to content

Deprecate cpu-utilization and add cpu-utilization-pct for multi-core support - #1515

Open
charanjith-anet wants to merge 3 commits into
openconfig:masterfrom
charanjith-anet:fix-procmon-cpu-utilization
Open

Deprecate cpu-utilization and add cpu-utilization-pct for multi-core support#1515
charanjith-anet wants to merge 3 commits into
openconfig:masterfrom
charanjith-anet:fix-procmon-cpu-utilization

Conversation

@charanjith-anet

@charanjith-anet charanjith-anet commented Jul 14, 2026

Copy link
Copy Markdown

Summary

  • Deprecate the existing cpu-utilization leaf (oc-types:percentage, uint8 range 0-100)
  • Add new cpu-utilization-pct leaf with uint32 type to support multi-core systems where per-process CPU utilization can exceed 100%
  • Bump module version from 0.4.0 to 0.5.0

Background

The cpu-utilization leaf under /system/processes/process/state is backed by /proc/PID/stat in Linux-based implementations. On multi-core systems, a process using multiple cores can report CPU utilization exceeding 100% (up to 100% per core). The previous type oc-types:percentage restricts values to 0-100, which is insufficient.

A new leaf is added instead of modifying the existing type to preserve backward compatibility — downstream consumers may have strict type handling or run mixed model versions.

Test plan

  • Verify YANG model compiles with pyang
  • Validate backward compatibility with existing consumers of cpu-utilization

The cpu-utilization leaf in openconfig-procmon used oc-types:percentage
(uint8, range 0-100), which cannot represent CPU utilization on
multi-core systems where per-process values can exceed 100%.
Change the type to uint16 to accommodate this.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the openconfig-procmon.yang module to version 0.5.0, changing the cpu-utilization leaf type from oc-types:percentage to uint16 to support multi-core systems where CPU utilization can exceed 100%. The review feedback recommends using uint32 instead of uint16 to prevent potential overflow on systems with more than 655 cores, and adding an explicit units "percentage" statement to maintain self-documentation.

Comment thread release/models/system/openconfig-procmon.yang
@navaneethyv

Copy link
Copy Markdown
Contributor

OC operator review Jul 14:
Changing an existing representation of a data type might break assumptions.

Can you please look at having cpu-utilization-uint32 as an alternative ?

@navaneethyv navaneethyv moved this to Ready to discuss in OC Operator Review Jul 14, 2026
@earies

earies commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

OC operator review Jul 14: Changing an existing representation of a data type might break assumptions.

Can you please look at having cpu-utilization-uint32 as an alternative ?

Agreed - widening a type is probably safe in most scenarios but any strict handling or hybrid env running different versions of the modeling complicates matters that we honestly cannot probably fully know, especially as time goes on and adoption increases.

As far as the proposal, I agree this is a gap in the current definition that needs to be fixed.

Add a new cpu-utilization-pct leaf with uint32 type to support
multi-core systems where per-process CPU utilization can exceed
100%. Deprecate the existing cpu-utilization leaf to preserve
backward compatibility.
@charanjith-anet charanjith-anet changed the title Change cpu-utilization type to uint16 for multi-core support Deprecate cpu-utilization and add cpu-utilization-pct for multi-core support Jul 14, 2026
Comment thread release/models/system/openconfig-procmon.yang
@navaneethyv

Copy link
Copy Markdown
Contributor

OC review : July 28th moving ahead.

@navaneethyv navaneethyv moved this from Ready to discuss to last-call in OC Operator Review Jul 28, 2026
@navaneethyv

Copy link
Copy Markdown
Contributor

OC operator's review August 4th.

Taking it further to merge.

@navaneethyv

Copy link
Copy Markdown
Contributor

/gcbrun

@navaneethyv navaneethyv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving.

@OpenConfigBot

Copy link
Copy Markdown

No major YANG version changes in commit ca2738d

}

leaf cpu-utilization-pct {
type uint32;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One additional thought that I think would be helpful here for various renderings is make this a typedef, take the type, units, description verbatim - call the typedef something like oc-types:multi-core-percentage then we get a descriptive type and reuse as this will probably come up in other future uses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: last-call

Development

Successfully merging this pull request may close these issues.

4 participants