DaanHoogland commented on a change in pull request #5588:
URL: https://github.com/apache/cloudstack/pull/5588#discussion_r782294976
##########
File path:
plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java
##########
@@ -335,61 +362,144 @@ public InfrastructureResponse listInfrastructure() {
}
final Long clusterId = cluster.getId();
- // Thresholds
- final Double cpuThreshold =
AlertManager.CPUCapacityThreshold.valueIn(clusterId);
- final Double memoryThreshold =
AlertManager.MemoryCapacityThreshold.valueIn(clusterId);
- final Float cpuDisableThreshold =
DeploymentClusterPlanner.ClusterCPUCapacityDisableThreshold.valueIn(clusterId);
- final Float memoryDisableThreshold =
DeploymentClusterPlanner.ClusterMemoryCapacityDisableThreshold.valueIn(clusterId);
-
// CPU and memory capacities
final CapacityDaoImpl.SummedCapacity cpuCapacity =
getCapacity((int) Capacity.CAPACITY_TYPE_CPU, null, clusterId);
final CapacityDaoImpl.SummedCapacity memoryCapacity =
getCapacity((int) Capacity.CAPACITY_TYPE_MEMORY, null, clusterId);
- final Metrics metrics = new Metrics(cpuCapacity, memoryCapacity);
+ final HostMetrics hostMetrics = new HostMetrics(cpuCapacity,
memoryCapacity);
for (final Host host: hostDao.findByClusterId(clusterId)) {
if (host == null || host.getType() != Host.Type.Routing) {
continue;
}
if (host.getStatus() == Status.Up) {
- metrics.incrUpResources();
+ hostMetrics.incrUpResources();
}
- metrics.incrTotalResources();
- updateHostMetrics(metrics, hostJoinDao.findById(host.getId()));
+ hostMetrics.incrTotalResources();
+ updateHostMetrics(hostMetrics,
hostJoinDao.findById(host.getId()));
}
metricsResponse.setState(clusterResponse.getAllocationState(),
clusterResponse.getManagedState());
- metricsResponse.setResources(metrics.getUpResources(),
metrics.getTotalResources());
- // CPU
- metricsResponse.setCpuTotal(metrics.getTotalCpu());
- metricsResponse.setCpuAllocated(metrics.getCpuAllocated(),
metrics.getTotalCpu());
- if (metrics.getCpuUsedPercentage() > 0L) {
- metricsResponse.setCpuUsed(metrics.getCpuUsedPercentage(),
metrics.getTotalHosts());
-
metricsResponse.setCpuMaxDeviation(metrics.getMaximumCpuUsage(),
metrics.getCpuUsedPercentage(), metrics.getTotalHosts());
+ metricsResponse.setResources(hostMetrics.getUpResources(),
hostMetrics.getTotalResources());
+ // add CPU and Memory metrics
Review comment:
no, it was a placeholder and should be removed :man_facepalming:
--
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]