mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-9900: Fix high CPU deviation issues seen in metrics view
HostStats returns cpu usage in percentage while memory usage in bytes. This fixes a regression in maximum CPU usage deviation that did not assume the values to be in percentage and multiple the final ratios with 100 which leads to 100x the actual deviation value. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
bdc4fd700b
commit
efe7646977
|
|
@ -128,10 +128,10 @@ public class ClusterMetricsResponse extends ClusterResponse {
|
|||
}
|
||||
}
|
||||
|
||||
public void setCpuMaxDeviation(final Double maxCpuDeviation, final Double totalCpuUsed, final Long totalHosts) {
|
||||
if (maxCpuDeviation != null && totalCpuUsed != null && totalHosts != null && totalHosts != 0) {
|
||||
final Double averageCpuUsage = totalCpuUsed / totalHosts;
|
||||
this.cpuMaxDeviation = String.format("%.2f%%", (maxCpuDeviation - averageCpuUsage) * 100.0 / averageCpuUsage);
|
||||
public void setCpuMaxDeviation(final Double maxCpuUsagePercentage, final Double totalCpuUsedPercentage, final Long totalHosts) {
|
||||
if (maxCpuUsagePercentage != null && totalCpuUsedPercentage != null && totalHosts != null && totalHosts != 0) {
|
||||
final Double averageCpuUsagePercentage = totalCpuUsedPercentage / totalHosts;
|
||||
this.cpuMaxDeviation = String.format("%.2f%%", (maxCpuUsagePercentage - averageCpuUsagePercentage) / averageCpuUsagePercentage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,10 +123,10 @@ public class ZoneMetricsResponse extends ZoneResponse {
|
|||
}
|
||||
}
|
||||
|
||||
public void setCpuMaxDeviation(final Double maxCpuDeviation, final Double totalCpuUsed, final Long totalHosts) {
|
||||
if (maxCpuDeviation != null && totalCpuUsed != null && totalHosts != null && totalHosts != 0) {
|
||||
final Double averageCpuUsage = totalCpuUsed / totalHosts;
|
||||
this.cpuMaxDeviation = String.format("%.2f%%", (maxCpuDeviation - averageCpuUsage) * 100.0 / averageCpuUsage);
|
||||
public void setCpuMaxDeviation(final Double maxCpuUsagePercentage, final Double totalCpuUsedPercentage, final Long totalHosts) {
|
||||
if (maxCpuUsagePercentage != null && totalCpuUsedPercentage != null && totalHosts != null && totalHosts != 0) {
|
||||
final Double averageCpuUsagePercentage = totalCpuUsedPercentage / totalHosts;
|
||||
this.cpuMaxDeviation = String.format("%.2f%%", (maxCpuUsagePercentage - averageCpuUsagePercentage) / averageCpuUsagePercentage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue