Skip to content
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

Add energy metrics to load-watcher #73

Merged
merged 2 commits into from
Nov 12, 2024
Merged

Conversation

jpedro1992
Copy link
Contributor

What type of PR is this?

Addition of energy metrics in load-watcher.

Related issue

#72

Summary

Additional metrics:

promScaphHostPower           = "scaph_host_power_microwatts"
promScaphHostJoules          = "scaph_host_energy_microjoules"
promKeplerHostCoreJoules     = "kepler_node_core_joules_total"
promKeplerHostUncoreJoules   = "kepler_node_uncore_joules_total"
promKeplerHostDRAMJoules     = "kepler_node_dram_joules_total"
promKeplerHostPackageJoules  = "kepler_node_package_joules_total"
promKeplerHostOtherJoules    = "kepler_node_other_joules_total"
promKeplerHostGPUJoules      = "kepler_node_gpu_joules_total"
promKeplerHostPlatformJoules = "kepler_node_platform_joules_total"
promKeplerHostEnergyStat     = "kepler_node_energy_stat"

@@ -259,6 +273,26 @@ func (s promClient) promResults2MetricMap(promresults model.Value, metric string
metricType = watcher.Memory
} else if metric == promDiskIOMetric {
metricType = watcher.Storage
} else if metric == promScaphHostPower {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should use switch case for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. What about something like this:

switch metric {
	case promCpuMetric: // CPU metrics
		metricType = watcher.CPU
	case promMemMetric: // Memory metrics
		metricType = watcher.Memory
	case promDiskIOMetric: // Storage metrics
		metricType = watcher.Storage
	case promScaphHostPower, promScaphHostJoules, // Energy-related metrics
		promKeplerHostCoreJoules, promKeplerHostUncoreJoules,
		promKeplerHostDRAMJoules, promKeplerHostPackageJoules,
		promKeplerHostOtherJoules, promKeplerHostGPUJoules,
		promKeplerHostPlatformJoules, promKeplerHostEnergyStat: 
		metricType = watcher.Energy
	case promTransBandMetric, promTransBandDropMetric, // Bandwidth-related metrics
	promRecBandMetric, promRecBandDropMetric:
		metricType = watcher.Bandwidth
	default:
		metricType = watcher.Unknown
	}

Copy link
Collaborator

Choose a reason for hiding this comment

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

looks good to me.

@lenhattan86 lenhattan86 merged commit 500faea into paypal:master Nov 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants