soreana commented on code in PR #7007:
URL: https://github.com/apache/cloudstack/pull/7007#discussion_r1057565506
##########
plugins/integrations/prometheus/src/main/java/org/apache/cloudstack/metrics/PrometheusExporterImpl.java:
##########
@@ -166,7 +167,7 @@ private void addHostMetrics(final List<Item> metricsList,
final long dcId, final
final String memoryFactor =
String.valueOf(CapacityManager.MemOverprovisioningFactor.valueIn(host.getClusterId()));
final CapacityVO memCapacity =
capacityDao.findByHostIdType(host.getId(), Capacity.CAPACITY_TYPE_MEMORY);
- if (memCapacity != null) {
+ if (memCapacity != null && memCapacity.getCapacityState() ==
CapacityState.Enabled) {
Review Comment:
@benj-n And also here.
##########
plugins/integrations/prometheus/src/main/java/org/apache/cloudstack/metrics/PrometheusExporterImpl.java:
##########
@@ -177,7 +178,7 @@ private void addHostMetrics(final List<Item> metricsList,
final long dcId, final
metricsList.add(new ItemHostVM(zoneName, zoneUuid, host.getName(),
host.getUuid(), host.getPrivateIpAddress(),
vmDao.listByHostId(host.getId()).size()));
final CapacityVO coreCapacity =
capacityDao.findByHostIdType(host.getId(), Capacity.CAPACITY_TYPE_CPU_CORE);
- if (coreCapacity != null) {
+ if (coreCapacity != null && coreCapacity.getCapacityState() ==
CapacityState.Enabled) {
Review Comment:
@benj-n And here as well.
##########
plugins/integrations/prometheus/src/main/java/org/apache/cloudstack/metrics/PrometheusExporterImpl.java:
##########
@@ -156,7 +157,7 @@ private void addHostMetrics(final List<Item> metricsList,
final long dcId, final
final String cpuFactor =
String.valueOf(CapacityManager.CpuOverprovisioningFactor.valueIn(host.getClusterId()));
final CapacityVO cpuCapacity =
capacityDao.findByHostIdType(host.getId(), Capacity.CAPACITY_TYPE_CPU);
- if (cpuCapacity != null) {
+ if (cpuCapacity != null && cpuCapacity.getCapacityState() ==
CapacityState.Enabled) {
Review Comment:
@benj-n We use 0 value to check if the host is in the maintenance. If you
only show enabled hosts entries, is is not possible to track hosts in
maintenance. I prefer to modify these if statement in a way that it shows zero
for hosts in maintenance mode and the correct value for the reset.
Or if you really want to exclude disabled hosts entries from prometheus
exporter, can you please add a global setting to control that?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]