Skip to content

fix: add label node_name to kepler_node_cpu_info metric - #2559

Merged
vprashar2929 merged 1 commit into
sustainable-computing-io:mainfrom
ffais:cpu-info-nodename
Sep 27, 2026
Merged

vprashar2929 merged 1 commit into
sustainable-computing-io:mainfrom
ffais:cpu-info-nodename

Conversation

@ffais

@ffais ffais commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR add node_name label to the kepler_node_cpu_info metric to make it consistent with the other metrics.

Upgrade note

kepler_node_cpu_info now carries a node_name label, matching kepler_node_gpu_info and the power metrics.
Because the label set changes, existing kepler_node_cpu_info series end at upgrade and new series (with node_name`) start.
The bundled Grafana dashboards are unaffected. Custom queries, recording rules or alerts that match on the
full label set of this metric may need updating.

@github-actions github-actions Bot added the fix A bug fix label Sep 24, 2026

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this, looks good to me and nothing is blocking. kepler_node_gpu_info and the power metrics already carry node_name as a const label, so this lines kepler_node_cpu_info up with them. Both callers of NewCPUInfoCollector are updated, and the docs/user/metrics.md hunk has the same shape the generator emits for the other metrics.

One test suggestion inline, plus two small notes:

  • The commit scope is fix(device), but the change is in the Prometheus exporter. fix(exporter): ... would describe it better.
  • A new label changes the series identity, so each kepler_node_cpu_info series ends at upgrade and a new one starts. The bundled dashboards' count by (...) and label_values(..., instance) queries don't group on node_name, so they are fine. A line in the PR description would help whoever writes the release notes.

Comment thread internal/exporter/prometheus/collector/cpuinfo_test.go

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, d64920d4 covers all three: node_name is in expectedLabels(), the scope is exporter, and the upgrade note is in the description. LGTM.

@bitflicker64

Copy link
Copy Markdown
Member

@vprashar2929 could you take a look at this one? I've reviewed and approved it, but my approval doesn't count toward the merge requirement until #2550 lands. The contributor is new here, so the workflows also need "Approve and run" before pre-commit can pass.

Comment thread internal/exporter/prometheus/collector/cpuinfo_test.go
Comment thread internal/exporter/prometheus/collector/cpuinfo.go

@sthaha sthaha 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.

Looks good overall but I think we shouldn't make 'node-name' mandatory.

@sthaha sthaha 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.

LGTM!

@codecov

codecov Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.46%. Comparing base (1caf690) to head (5d3e7a6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2559      +/-   ##
==========================================
+ Coverage   92.41%   92.46%   +0.04%     
==========================================
  Files          58       58              
  Lines        6121     6121              
==========================================
+ Hits         5657     5660       +3     
+ Misses        329      327       -2     
+ Partials      135      134       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Profiling reports are ready to be viewed

⚠️ Variability in pprof CPU and Memory profiles
When comparing pprof profiles of Kepler versions, expect variability in CPU and memory. Focus only on significant, consistent differences.

💻 CPU Comparison with base Kepler
File: kepler
Build ID: 220460d6cb8f7af570472b5fee38f490301b96ca
Type: cpu
Time: 2026-09-27 07:30:58 UTC
Duration: 120s, Total samples = 3.77s ( 3.14%)
Active filters:
   show=github.com/sustainable-computing-io
Showing nodes accounting for 0, 0% of 3.77s total
      flat  flat%   sum%        cum   cum%
         0     0%     0%     -0.10s  2.65%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).calculatePower
         0     0%     0%     -0.10s  2.65%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).refreshSnapshot
         0     0%     0%     -0.10s  2.65%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).synchronizedPowerRefresh
         0     0%     0%     -0.10s  2.65%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).synchronizedPowerRefresh.func1
         0     0%     0%     -0.09s  2.39%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*gpuInfoCollector).Collect
         0     0%     0%     -0.08s  2.12%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).Snapshot
    -0.01s  0.27%  0.27%     -0.07s  1.86%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).Refresh
    -0.01s  0.27%  0.53%     -0.07s  1.86%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).updateProcessCache
     0.06s  1.59%  1.06%      0.06s  1.59%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*realProcFS).CPUInfo
         0     0%  1.06%     -0.06s  1.59%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).ensureFreshData
     0.06s  1.59%  2.65%      0.06s  1.59%  github.com/sustainable-computing-io/kepler/internal/resource.(*procFSReader).CPUUsageRatio
    -0.06s  1.59%  1.06%     -0.06s  1.59%  github.com/sustainable-computing-io/kepler/internal/resource.(*procWrapper).CPUTime
         0     0%  1.06%      0.06s  1.59%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).Refresh.func3
         0     0%  1.06%      0.06s  1.59%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).refreshNode
         0     0%  1.06%     -0.06s  1.59%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).refreshProcesses
         0     0%  1.06%     -0.06s  1.59%  github.com/sustainable-computing-io/kepler/internal/resource.populateProcessFields
    -0.01s  0.27%   0.8%      0.05s  1.33%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*cpuInfoCollector).Collect
         0     0%   0.8%     -0.04s  1.06%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).scheduleNextCollection.func1
    -0.02s  0.53%  0.27%     -0.03s   0.8%  github.com/sustainable-computing-io/kepler/internal/monitor.(*Process).Clone (inline)
         0     0%  0.27%     -0.02s  0.53%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).calculateProcessPower
     0.01s  0.27%  0.53%     -0.02s  0.53%  github.com/sustainable-computing-io/kepler/internal/monitor.(*Snapshot).Clone
    -0.02s  0.53%     0%     -0.02s  0.53%  github.com/sustainable-computing-io/kepler/internal/monitor.newProcess (inline)
     0.01s  0.27%  0.27%      0.01s  0.27%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*PlatformCollector).Collect
         0     0%  0.27%      0.01s  0.27%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*PowerCollector).Collect
    -0.01s  0.27%     0%     -0.01s  0.27%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).calculateContainerPower
     0.01s  0.27%  0.27%      0.01s  0.27%  github.com/sustainable-computing-io/kepler/internal/resource.(*procFSReader).AllProcs
     0.01s  0.27%  0.53%      0.01s  0.27%  github.com/sustainable-computing-io/kepler/internal/resource.(*procWrapper).Comm
    -0.01s  0.27%  0.27%     -0.01s  0.27%  github.com/sustainable-computing-io/kepler/internal/resource.(*procWrapper).Executable
         0     0%  0.27%     -0.01s  0.27%  github.com/sustainable-computing-io/kepler/internal/resource.newProcess
    -0.01s  0.27%     0%     -0.01s  0.27%  maps.Copy[go.shape.map[github.com/sustainable-computing-io/kepler/internal/device.EnergyZone]github.com/sustainable-computing-io/kepler/internal/monitor.Usage,go.shape.map[github.com/sustainable-computing-io/kepler/internal/device.EnergyZone]github.com/sustainable-computing-io/kepler/internal/monitor.Usage,go.shape.interface { Energy ; Index int; MaxEnergy github.com/sustainable-computing-io/kepler/internal/device.Energy; Name string; Path string; Power  },go.shape.struct { EnergyTotal github.com/sustainable-computing-io/kepler/internal/device.Energy; Power github.com/sustainable-computing-io/kepler/internal/device.Power }] (inline)
💾 Memory Comparison with base Kepler (Inuse)
File: kepler
Build ID: 220460d6cb8f7af570472b5fee38f490301b96ca
Type: inuse_space
Time: 2026-09-27 07:32:58 UTC
Duration: 120.02s, Total samples = 7511.90kB 
Active filters:
   show=github.com/sustainable-computing-io
Showing nodes accounting for -1552.21kB, 20.66% of 7511.90kB total
      flat  flat%   sum%        cum   cum%
         0     0%     0% -1536.18kB 20.45%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*PowerCollector).Collect
-1024.04kB 13.63% 13.63% -1024.04kB 13.63%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*PowerCollector).collectProcessMetrics
         0     0% 13.63%  -528.17kB  7.03%  github.com/sustainable-computing-io/kepler/internal/resource.computeTypeInfoFromProc.func1
 -528.17kB  7.03% 20.66%  -528.17kB  7.03%  github.com/sustainable-computing-io/kepler/internal/resource.containerInfoFromCgroupPaths
         0     0% 20.66%  -528.17kB  7.03%  github.com/sustainable-computing-io/kepler/internal/resource.containerInfoFromProc
         0     0% 20.66%   512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*gpuInfoCollector).Collect
         0     0% 20.66%   512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).calculatePower
         0     0% 20.66%   512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).calculateProcessPower
         0     0% 20.66%   512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).ensureFreshData
         0     0% 20.66%   512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).refreshSnapshot
         0     0% 20.66%   512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).synchronizedPowerRefresh
         0     0% 20.66%   512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).synchronizedPowerRefresh.func1
         0     0% 20.66%  -512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.(*Process).Clone (inline)
         0     0% 20.66%  -512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.(*Snapshot).Clone
  512.14kB  6.82% 13.85%   512.14kB  6.82%  github.com/sustainable-computing-io/kepler/internal/monitor.newProcess (inline)
 -512.14kB  6.82% 20.66%  -512.14kB  6.82%  maps.Copy[go.shape.map[github.com/sustainable-computing-io/kepler/internal/device.EnergyZone]github.com/sustainable-computing-io/kepler/internal/monitor.Usage,go.shape.map[github.com/sustainable-computing-io/kepler/internal/device.EnergyZone]github.com/sustainable-computing-io/kepler/internal/monitor.Usage,go.shape.interface { Energy ; Index int; MaxEnergy github.com/sustainable-computing-io/kepler/internal/device.Energy; Name string; Path string; Power  },go.shape.struct { EnergyTotal github.com/sustainable-computing-io/kepler/internal/device.Energy; Power github.com/sustainable-computing-io/kepler/internal/device.Power }] (inline)
💾 Memory Comparison with base Kepler (Alloc)
File: kepler
Build ID: 220460d6cb8f7af570472b5fee38f490301b96ca
Type: alloc_space
Time: 2026-09-27 07:32:58 UTC
Duration: 120.02s, Total samples = 193.18MB 
Active filters:
   show=github.com/sustainable-computing-io
Showing nodes accounting for -2.35MB, 1.21% of 193.18MB total
Dropped 2 nodes (cum <= 0.97MB)
      flat  flat%   sum%        cum   cum%
         0     0%     0%    -8.01MB  4.14%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).scheduleNextCollection.func1
         0     0%     0%     7.54MB  3.91%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*gpuInfoCollector).Collect
         0     0%     0%    -5.49MB  2.84%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*PowerCollector).Collect
         0     0%     0%     5.04MB  2.61%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).ensureFreshData
         0     0%     0%     4.05MB  2.10%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).Snapshot
   -0.50MB  0.26%  0.26%    -2.97MB  1.54%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).refreshSnapshot
         0     0%  0.26%    -2.97MB  1.54%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).synchronizedPowerRefresh
         0     0%  0.26%    -2.97MB  1.54%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).synchronizedPowerRefresh.func1
         0     0%  0.26%    -2.97MB  1.54%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).calculatePower
      -2MB  1.04%  1.29%       -2MB  1.04%  maps.Copy[go.shape.map[github.com/sustainable-computing-io/kepler/internal/device.EnergyZone]github.com/sustainable-computing-io/kepler/internal/monitor.Usage,go.shape.map[github.com/sustainable-computing-io/kepler/internal/device.EnergyZone]github.com/sustainable-computing-io/kepler/internal/monitor.Usage,go.shape.interface { Energy ; Index int; MaxEnergy github.com/sustainable-computing-io/kepler/internal/device.Energy; Name string; Path string; Power  },go.shape.struct { EnergyTotal github.com/sustainable-computing-io/kepler/internal/device.Energy; Power github.com/sustainable-computing-io/kepler/internal/device.Power }] (inline)
      -2MB  1.04%  2.33%       -2MB  1.04%  github.com/sustainable-computing-io/kepler/internal/monitor.newProcess (inline)
      -2MB  1.03%  3.36%       -2MB  1.03%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*PowerCollector).collectProcessMetrics
         0     0%  3.36%     1.51MB  0.78%  github.com/sustainable-computing-io/kepler/internal/resource.computeTypeInfoFromProc.func2
    1.51MB  0.78%  2.58%     1.51MB  0.78%  github.com/sustainable-computing-io/kepler/internal/resource.vmInfoFromCmdLine
         0     0%  2.58%     1.51MB  0.78%  github.com/sustainable-computing-io/kepler/internal/resource.vmInfoFromProc
    0.50MB  0.26%  2.32%    -1.50MB  0.78%  github.com/sustainable-computing-io/kepler/internal/monitor.(*Process).Clone (inline)
         0     0%  2.32%    -1.48MB  0.77%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).Refresh
   -0.51MB  0.26%  2.59%    -1.48MB  0.77%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).refreshProcesses
    1.08MB  0.56%  2.03%     1.08MB  0.56%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*realProcFS).CPUInfo
         0     0%  2.03%     1.02MB  0.53%  github.com/sustainable-computing-io/kepler/internal/resource.computeTypeInfoFromProc.func1
    1.02MB  0.53%  1.50%     1.02MB  0.53%  github.com/sustainable-computing-io/kepler/internal/resource.containerInfoFromCgroupPaths
         0     0%  1.50%     1.02MB  0.53%  github.com/sustainable-computing-io/kepler/internal/resource.containerInfoFromProc
    0.51MB  0.27%  1.24%    -0.99MB  0.51%  github.com/sustainable-computing-io/kepler/internal/monitor.(*Snapshot).Clone
    0.51MB  0.27%  0.97%    -0.99MB  0.51%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).calculateProcessPower
   -0.47MB  0.25%  1.22%    -0.97MB   0.5%  github.com/sustainable-computing-io/kepler/internal/resource.(*procFSReader).AllProcs
    0.50MB  0.26%  0.96%     0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/resource.(*procFSReader).CPUUsageRatio
         0     0%  0.96%     0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).Refresh.func3
         0     0%  0.96%     0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/resource.(*resourceInformer).refreshNode
         0     0%  0.96%    -0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/device.(*AggregatedZone).Energy
   -0.50MB  0.26%  1.21%    -0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/device.sysfsRaplZone.Energy
         0     0%  1.21%    -0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).calculateNodePower
    0.50MB  0.26%  0.96%     0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*PlatformCollector).Collect
    0.50MB  0.26%   0.7%     0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/logger.handlerForFormat.func1
         0     0%   0.7%     0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/monitor.(*PowerMonitor).refreshSnapshot.func1
   -0.50MB  0.26%  0.96%    -0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/resource.WrapProc (inline)
   -0.50MB  0.26%  1.21%    -0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/resource.(*procWrapper).Executable
    0.50MB  0.26%  0.96%     0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/monitor.(*Process).StringID (inline)
    0.50MB  0.26%   0.7%     0.50MB  0.26%  github.com/sustainable-computing-io/kepler/internal/resource.(*procWrapper).CPUTime
      -1MB  0.52%  1.21%     0.08MB 0.041%  github.com/sustainable-computing-io/kepler/internal/exporter/prometheus/collector.(*cpuInfoCollector).Collect

⬇️ Download the Profiling artifacts from the Actions Summary page

📦 Artifact name: profile-artifacts-2559

🔧 Or use GitHub CLI to download artifacts:

gh run download 36303206960 -n profile-artifacts-2559

@vprashar2929
vprashar2929 merged commit 7c688e6 into sustainable-computing-io:main Sep 27, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants