Skip to content

Add CPU saturation-pct min/max ODS metrics for allotment monitoring (#558) - #558

Open
cmgrace wants to merge 2 commits into
mainfrom
export-D105619438
Open

Add CPU saturation-pct min/max ODS metrics for allotment monitoring (#558)#558
cmgrace wants to merge 2 commits into
mainfrom
export-D105619438

Conversation

@cmgrace

@cmgrace cmgrace commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary:

Adds min.60/max.60 aggregations for cpu.saturation-pct, extracted from D104745222 for a cleaner diff stack.

New ODS keys (gated with TargetedOdsFilter defaultPublish=false):

  • dyno.allotment.cpu.saturation-pct.min.60
  • dyno.allotment.cpu.saturation-pct.max.60

These use the same /proc/stat PROC_STAT data source as the existing saturation-pct avg and percentile metrics, with the readCgroupStat_ fallback honored. Values are normalized to percentage of the allotment cpuSaturationLimit.

Adds getMinCPUCoresUsage() and getMaxCPUCoresUsage() to CPUTimeMonitor using raw() + std::min/max_element since MetricSeries lacks built-in min/max.

Design doc: https://docs.google.com/document/d/16ea49QzoL60PTtFQ0DXss4Bmq7aCnSGh4MuG9phMmO0/edit

Differential Revision: D105619438

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 21, 2026
@meta-codesync

meta-codesync Bot commented May 21, 2026

Copy link
Copy Markdown

@cmgrace has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105619438.

@meta-codesync meta-codesync Bot changed the title Add CPU saturation-pct min/max ODS metrics for allotment monitoring Add CPU saturation-pct min/max ODS metrics for allotment monitoring (#558) May 26, 2026
meta-codesync Bot pushed a commit that referenced this pull request May 26, 2026
…558)

Summary:

Adds min.60/max.60 aggregations for cpu.saturation-pct, extracted from D104745222 for a cleaner diff stack.

New ODS keys (gated with TargetedOdsFilter defaultPublish=false):
- dyno.allotment.cpu.saturation-pct.min.60
- dyno.allotment.cpu.saturation-pct.max.60

These use the same /proc/stat PROC_STAT data source as the existing saturation-pct avg and percentile metrics, with the readCgroupStat_ fallback honored. Values are normalized to percentage of the allotment cpuSaturationLimit.

Adds getMinCPUCoresUsage() and getMaxCPUCoresUsage() to CPUTimeMonitor using raw() + std::min/max_element since MetricSeries lacks built-in min/max.

Design doc: https://docs.google.com/document/d/16ea49QzoL60PTtFQ0DXss4Bmq7aCnSGh4MuG9phMmO0/edit

Differential Revision: D105619438
@meta-codesync
meta-codesync Bot force-pushed the export-D105619438 branch from 4b3c93d to f52b7ae Compare May 26, 2026 00:16
meta-codesync Bot pushed a commit that referenced this pull request May 26, 2026
…558)

Summary:

Adds min.60/max.60 aggregations for cpu.saturation-pct, extracted from D104745222 for a cleaner diff stack.

New ODS keys (gated with TargetedOdsFilter defaultPublish=false):
- dyno.allotment.cpu.saturation-pct.min.60
- dyno.allotment.cpu.saturation-pct.max.60

These use the same /proc/stat PROC_STAT data source as the existing saturation-pct avg and percentile metrics, with the readCgroupStat_ fallback honored. Values are normalized to percentage of the allotment cpuSaturationLimit.

Adds getMinCPUCoresUsage() and getMaxCPUCoresUsage() to CPUTimeMonitor using raw() + std::min/max_element since MetricSeries lacks built-in min/max.

Design doc: https://docs.google.com/document/d/16ea49QzoL60PTtFQ0DXss4Bmq7aCnSGh4MuG9phMmO0/edit

Differential Revision: D105619438
@meta-codesync
meta-codesync Bot force-pushed the export-D105619438 branch from f52b7ae to 40e7703 Compare May 26, 2026 00:20
meta-codesync Bot pushed a commit that referenced this pull request May 28, 2026
…558)

Summary:

Adds min.60/max.60 aggregations for cpu.saturation-pct, extracted from D104745222 for a cleaner diff stack.

New ODS keys (gated with TargetedOdsFilter defaultPublish=false):
- dyno.allotment.cpu.saturation-pct.min.60
- dyno.allotment.cpu.saturation-pct.max.60

These use the same /proc/stat PROC_STAT data source as the existing saturation-pct avg and percentile metrics, with the readCgroupStat_ fallback honored. Values are normalized to percentage of the allotment cpuSaturationLimit.

Adds getMinCPUCoresUsage() and getMaxCPUCoresUsage() to CPUTimeMonitor using raw() + std::min/max_element since MetricSeries lacks built-in min/max.

Design doc: https://docs.google.com/document/d/16ea49QzoL60PTtFQ0DXss4Bmq7aCnSGh4MuG9phMmO0/edit

Differential Revision: D105619438
@meta-codesync
meta-codesync Bot force-pushed the export-D105619438 branch from 40e7703 to 0becb70 Compare May 28, 2026 16:59
meta-codesync Bot pushed a commit that referenced this pull request May 28, 2026
…558)

Summary:

Adds min.60/max.60 aggregations for cpu.saturation-pct, extracted from D104745222 for a cleaner diff stack.

New ODS keys (gated with TargetedOdsFilter defaultPublish=false):
- dyno.allotment.cpu.saturation-pct.min.60
- dyno.allotment.cpu.saturation-pct.max.60

These use the same /proc/stat PROC_STAT data source as the existing saturation-pct avg and percentile metrics, with the readCgroupStat_ fallback honored. Values are normalized to percentage of the allotment cpuSaturationLimit.

Adds getMinCPUCoresUsage() and getMaxCPUCoresUsage() to CPUTimeMonitor using raw() + std::min/max_element since MetricSeries lacks built-in min/max.

Design doc: https://docs.google.com/document/d/16ea49QzoL60PTtFQ0DXss4Bmq7aCnSGh4MuG9phMmO0/edit

Differential Revision: D105619438
@meta-codesync
meta-codesync Bot force-pushed the export-D105619438 branch from 0becb70 to f140a32 Compare May 28, 2026 18:04
cmgrace added 2 commits May 28, 2026 11:04
…ent ODS (#554)

Summary:

Extends the allotment-level CPU metrics to support MySQL and ZippyDB stacking migration. This is part of the broader effort to expose allotment-level ODS metrics as these workloads move from whole-host shapes to stacked allotments.

Changes:
- Add cpu.nice breakdown metric from /proc/stat per-CPU nice field (not available in cgroup v2 cpu.stat) via CPUTimeMonitor, with avg/min/max aggregations
- Add min.60/max.60 aggregations for cpu.iowait and cpu.saturation-pct from CPUTimeMonitor /proc/stat data
- Add min.60/max.60 aggregations for cpu.user and cpu.sys from the cgroup ring buffer (AllotmentsMonitor::getCgroupCounterMinMax), keeping the existing cgroup data source for consistency with the avg metric
- Add kCpuSaturationMin/Max key specs to AllotmentCpuOdsKeySpecs
- Extract granularityToLevel() helper to deduplicate 6 identical switch blocks in CPUTimeMonitor
- Fix readCgroupStat_ fallback in getMinCPUCoresUsage/getMaxCPUCoresUsage to match existing getStat() behavior

All new ODS keys are gated behind TargetedOdsFilter::shouldPublish() with defaultPublish=false, so they only emit when an explicit allow rule is configured for the workload.

New ODS keys (all require TargetedOdsFilter config to publish):
- dyno.allotment.cpu.nice (avg via ODS suffix)
- dyno.allotment.cpu.{nice,iowait,idle,softirq,hardirq}.min.60 / .max.60
- dyno.allotment.cpu.user.min.60 / .max.60
- dyno.allotment.cpu.sys.min.60 / .max.60
- dyno.allotment.cpu.saturation-pct.min.60 / .max.60

Design doc: https://docs.google.com/document/d/16ea49QzoL60PTtFQ0DXss4Bmq7aCnSGh4MuG9phMmO0/edit

Differential Revision: D104745222
…558)

Summary:

Adds min.60/max.60 aggregations for cpu.saturation-pct, extracted from D104745222 for a cleaner diff stack.

New ODS keys (gated with TargetedOdsFilter defaultPublish=false):
- dyno.allotment.cpu.saturation-pct.min.60
- dyno.allotment.cpu.saturation-pct.max.60

These use the same /proc/stat PROC_STAT data source as the existing saturation-pct avg and percentile metrics, with the readCgroupStat_ fallback honored. Values are normalized to percentage of the allotment cpuSaturationLimit.

Adds getMinCPUCoresUsage() and getMaxCPUCoresUsage() to CPUTimeMonitor using raw() + std::min/max_element since MetricSeries lacks built-in min/max.

Design doc: https://docs.google.com/document/d/16ea49QzoL60PTtFQ0DXss4Bmq7aCnSGh4MuG9phMmO0/edit

Differential Revision: D105619438
@meta-codesync
meta-codesync Bot force-pushed the export-D105619438 branch from f140a32 to b3143b7 Compare May 28, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant