Skip to content

Commit

Permalink
Merge pull request #420 from sentrysoftware/feature/issue-368-km-modu…
Browse files Browse the repository at this point in the history
…le-issues-with-the-vm-class

Issue  #368:  KM module: issues with the VM class
  • Loading branch information
NassimBtk committed Sep 20, 2024
2 parents 2b62fad + 6750adb commit 2b1b94b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private void processKeyValue(final String key, final String value, final Map<Str
} else if (isLookupFunction(value)) {
result.put(key, lookup(value, key));
} else if (isComputePowerShareRatioFunction(value)) {
result.put(String.format("%s.raw_power_share", key), computePowerShareRatio(value, key));
result.put(String.format("__%s.raw_power_share", key), computePowerShareRatio(value, key));
} else if (isLegacyPowerSupplyUtilization(value)) {
computationFunctions.put(key, this::legacyPowerSupplyUtilization);
} else if (isFakeCounterFunction(value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class MappingProcessorTest {

private static final String HW_VM_POWER_RATIO = "__hw.vm.power_ratio";
private static final String HW_VM_POWER_RATIO = "hw.vm.power_ratio";
private static final String HW_VM_POWER_RATIO_RAW_POWER_SHARE = "__hw.vm.power_ratio.raw_power_share";

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64207,8 +64207,8 @@
"is_endpoint" : false
}, {
"metrics" : {
"hw.vm.power_ratio.raw_power_share" : {
"name" : "hw.vm.power_ratio.raw_power_share",
"__hw.vm.power_ratio.raw_power_share" : {
"name" : "__hw.vm.power_ratio.raw_power_share",
"collectTime" : 1715961673910,
"previousCollectTime" : null,
"attributes" : { },
Expand Down Expand Up @@ -64268,8 +64268,8 @@
"is_endpoint" : false
}, {
"metrics" : {
"hw.vm.power_ratio.raw_power_share" : {
"name" : "hw.vm.power_ratio.raw_power_share",
"__hw.vm.power_ratio.raw_power_share" : {
"name" : "__hw.vm.power_ratio.raw_power_share",
"collectTime" : 1715961673910,
"previousCollectTime" : null,
"attributes" : { },
Expand Down Expand Up @@ -64329,8 +64329,8 @@
"is_endpoint" : false
}, {
"metrics" : {
"hw.vm.power_ratio.raw_power_share" : {
"name" : "hw.vm.power_ratio.raw_power_share",
"__hw.vm.power_ratio.raw_power_share" : {
"name" : "__hw.vm.power_ratio.raw_power_share",
"collectTime" : 1715961673910,
"previousCollectTime" : null,
"attributes" : { },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import static org.sentrysoftware.metricshub.hardware.util.HwConstants.HW_HOST_ESTIMATED_POWER;
import static org.sentrysoftware.metricshub.hardware.util.HwConstants.HW_HOST_MEASURED_POWER;
import static org.sentrysoftware.metricshub.hardware.util.HwConstants.HW_POWER_VM_METRIC;
import static org.sentrysoftware.metricshub.hardware.util.HwConstants.HW_VM_POWER_SHARE_METRIC;
import static org.sentrysoftware.metricshub.hardware.util.HwConstants.POWER_SOURCE_ID_ATTRIBUTE;

import java.math.RoundingMode;
Expand Down Expand Up @@ -116,7 +115,7 @@ protected Double doPowerEstimation() {
final MetricFactory metricFactory = new MetricFactory(telemetryManager.getHostname());
metricFactory.collectNumberMetric(
monitor,
HW_VM_POWER_SHARE_METRIC,
"hw.vm.power_ratio",
powerShareRatio,
telemetryManager.getStrategyTime()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class HwConstants {
public static final String HW_POWER_VM_METRIC = "hw.power{hw.type=\"vm\"}";
public static final String POWER_SOURCE_ID_ATTRIBUTE = "__power_source_id";
public static final String HW_VM_POWER_SHARE_METRIC = "__hw.vm.power_ratio.raw_power_share";
public static final String HW_VM_POWER_STATE_METRIC = "hw.vm.power_state";
public static final String HW_VM_POWER_STATE_METRIC = "hw.power_state{hw.type=\"vm\"}";

public static final String HW_ENCLOSURE_POWER = "hw.enclosure.power";
public static final String HW_ENCLOSURE_ENERGY = "hw.enclosure.energy";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52313,8 +52313,8 @@
"is_endpoint" : false
}, {
"metrics" : {
"hw.vm.power_ratio.raw_power_share" : {
"name" : "hw.vm.power_ratio.raw_power_share",
"__hw.vm.power_ratio.raw_power_share" : {
"name" : "__hw.vm.power_ratio.raw_power_share",
"collectTime" : 1709803030590,
"previousCollectTime" : null,
"attributes" : { },
Expand Down Expand Up @@ -52359,8 +52359,8 @@
"is_endpoint" : false
}, {
"metrics" : {
"hw.vm.power_ratio.raw_power_share" : {
"name" : "hw.vm.power_ratio.raw_power_share",
"__hw.vm.power_ratio.raw_power_share" : {
"name" : "__hw.vm.power_ratio.raw_power_share",
"collectTime" : 1709803030590,
"previousCollectTime" : null,
"attributes" : { },
Expand Down Expand Up @@ -52405,8 +52405,8 @@
"is_endpoint" : false
}, {
"metrics" : {
"hw.vm.power_ratio.raw_power_share" : {
"name" : "hw.vm.power_ratio.raw_power_share",
"__hw.vm.power_ratio.raw_power_share" : {
"name" : "__hw.vm.power_ratio.raw_power_share",
"collectTime" : 1709803030590,
"previousCollectTime" : null,
"attributes" : { },
Expand Down

0 comments on commit 2b1b94b

Please sign in to comment.