Skip to content

Commit

Permalink
[INTERNAL] - Broker CPU utilization underestimated on Kubernetes
Browse files Browse the repository at this point in the history
See: linkedin#1242
This is an internal patch to use SystemCpuLoad to monitor broker pod
cpu usage knowing that we always run the broker in a container.
  • Loading branch information
amuraru committed Aug 2, 2020
1 parent 18fa9f9 commit ae41344
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static CruiseControlMetric toCruiseControlMetric(long now,
* @return the "recent CPU usage" for the JVM process as a double in [0.0,1.0].
*/
public static BrokerMetric getCpuMetric(long now, int brokerId, boolean kubernetesMode) throws IOException {
double cpuUtil = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getProcessCpuLoad();
double cpuUtil = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getSystemCpuLoad();

if (kubernetesMode) {
cpuUtil = ContainerMetricUtils.getContainerProcessCpuLoad(cpuUtil);
Expand Down

0 comments on commit ae41344

Please sign in to comment.