-
Notifications
You must be signed in to change notification settings - Fork 214
fix(exporter): move WithNodeName option to collector #2150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(exporter): move WithNodeName option to collector #2150
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 New features to boost your workflow:
|
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") | ||
} | ||
} |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
There was a problem hiding this 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>
101a55d
into
sustainable-computing-io:reboot
Moved WithNodeName() option from prometheus exporter to collector
added tests