NIFI-11921 Set CPU Load Average for C2 Heartbeats

This closes #7584

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Kalman Jantner 2023-08-08 16:25:07 +02:00 committed by exceptionfactory
parent cba6b00271
commit f8d0d2f9b6
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
2 changed files with 10 additions and 1 deletions

View File

@ -228,7 +228,7 @@ public class C2HeartbeatFactory {
// getSystemLoadAverage is not available in Windows, so we need to prevent to send invalid data
if (systemLoadAverage >= 0) {
systemInfo.setCpuUtilization(systemLoadAverage / (double) osMXBean.getAvailableProcessors());
systemInfo.setCpuLoadAverage(systemLoadAverage);
}
return systemInfo;

View File

@ -45,6 +45,7 @@ public class SystemInfo implements Serializable {
@ApiModelProperty
private Double cpuUtilization;
private Double cpuLoadAverage;
public String getMachineArch() {
return machineArch;
@ -93,4 +94,12 @@ public class SystemInfo implements Serializable {
public void setvCores(Integer vCores) {
this.vCores = vCores;
}
public Double getCpuLoadAverage() {
return cpuLoadAverage;
}
public void setCpuLoadAverage(Double cpuLoadAverage) {
this.cpuLoadAverage = cpuLoadAverage;
}
}