Skip to content

Commit

Permalink
fix(CPU load): Fix CPU load showing 0% in Runtime -> Metrics -> System
Browse files Browse the repository at this point in the history
  • Loading branch information
five-iron authored and tadayosi committed Aug 8, 2024
1 parent 3a9f4d6 commit ef87d11
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/hawtio/src/plugins/runtime/runtime-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,16 @@ class RuntimeService {
}
case 'java.lang:type=OperatingSystem': {
const osMetrics = response.value as {
SystemCpuLoad: number
CpuLoad?: number
SystemCpuLoad?: number
SystemLoadAverage: number
FreePhysicalMemorySize: number
TotalPhysicalMemorySize: number
AvailableProcessors: number
OpenFileDescriptorCount: number
MaxFileDescriptorCount: number
}
const cpuLoad = osMetrics.SystemCpuLoad * 100
const cpuLoad = (osMetrics.CpuLoad ?? osMetrics.SystemCpuLoad ?? 0) * 100
const loadAverage = osMetrics.SystemLoadAverage
const memFree = this.formatBytes(osMetrics.FreePhysicalMemorySize)
const memTotal = this.formatBytes(osMetrics.TotalPhysicalMemorySize)
Expand Down

0 comments on commit ef87d11

Please sign in to comment.