Skip to content

Conversation

vimalk78
Copy link
Collaborator

@vimalk78 vimalk78 commented Jun 12, 2025

Moved WithNodeName() option from prometheus exporter to collector
added tests

@github-actions github-actions bot added the fix A bug fix label Jun 12, 2025
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.35%. Comparing base (229c8c0) to head (32a40b8).
Report is 2 commits behind head on reboot.

Additional details and impacted files
@@            Coverage Diff             @@
##           reboot    #2150      +/-   ##
==========================================
- Coverage   91.47%   91.35%   -0.12%     
==========================================
  Files          36       36              
  Lines        3472     3472              
==========================================
- Hits         3176     3172       -4     
- Misses        229      232       +3     
- Partials       67       68       +1     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +333 to +345
for _, metric := range metrics {
if metric.GetName() == "kepler_process_cpu_joules_total" {
for _, m := range metric.GetMetric() {
nodeName := valueOfLabel(m, "node_name")
assert.Equal(t, "test-node", nodeName, "Process metrics should have node_name label")
}
}
if metric.GetName() == "kepler_process_cpu_watts" {
for _, m := range metric.GetMetric() {
nodeName := valueOfLabel(m, "node_name")
assert.Equal(t, "test-node", nodeName, "Process metrics should have node_name label")
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: refactor this into a helper function that assert that assertMetricLabelValue(t, name, label, value) we have something similar called asserrtMainMetricValue which I think can be replaced as well.

@@ -197,6 +197,7 @@ func createPrometheusExporter(logger *slog.Logger, cfg *config.Config, apiServer
pm,
prometheus.WithLogger(logger),
prometheus.WithProcFSPath(cfg.Host.ProcFS),
prometheus.WithNodeName(cfg.Kube.Node),
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice!

Copy link
Collaborator

@sthaha sthaha left a comment

Choose a reason for hiding this comment

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

lgtm! but ci :( .. some suggestions though

    Moved WithNodeName() option from prometheus exporter to collector
    Added tests

Signed-off-by: Vimal Kumar <vimal78@gmail.com>
@sthaha sthaha merged commit 101a55d into sustainable-computing-io:reboot Jun 13, 2025
16 of 18 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.

2 participants