harikrishna-patnala commented on code in PR #7629:
URL: https://github.com/apache/cloudstack/pull/7629#discussion_r1231779484


##########
plugins/integrations/prometheus/src/main/java/org/apache/cloudstack/metrics/PrometheusExporterImpl.java:
##########
@@ -158,20 +158,20 @@ 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 && cpuCapacity.getCapacityState() == 
CapacityState.Enabled) {
-                metricsList.add(new ItemHostCpu(zoneName, zoneUuid, 
host.getName(), host.getUuid(), host.getPrivateIpAddress(), cpuFactor, USED, 
cpuCapacity.getUsedCapacity(), isDedicated, hostTags));
+                metricsList.add(new ItemHostCpu(zoneName, zoneUuid, 
host.getName(), host.getUuid(), host.getPrivateIpAddress(), cpuFactor, 
ALLOCATED, cpuCapacity.getUsedCapacity(), isDedicated, hostTags));

Review Comment:
   Usually, Allocated space is the sum of used and reserved capacity. I'm not 
sure if getting "usedCapacity" and showing it as "Allocated" is the right way.
   
   @soreana Regarding the differences you are mentioning in the issue, the 
"memoryused" from the hostreponse is from the 
[hoststats](https://github.com/apache/cloudstack/blob/6125886f3d0b64ff3d0a743d00bf414774e7e2e3/server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java#L227)
 which is collected by stats collector from host and 
"cloudstack_host_memory_usage_mibs_total" from Prometheus is the value from 
"op_host_capacity" table (cpuCapacity.getUsedCapacity()). 
   
   If we want to show the same metrics in both hostmetrics and Prometheus then 
we need to get the usedcapacity from hoststats and report it as "USED" only.



-- 
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]

Reply via email to