Skip to content

Commit 7e6974b

Browse files
Add null checks for gauges (stats)
1 parent fde3337 commit 7e6974b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/app/core/services/metric.service.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,23 @@ class MetricService {
8989
}
9090

9191
calculateGauges(stats) {
92+
93+
if (!stats["gauges"]) {
94+
return {
95+
"cpuValue":0,
96+
"cpuPercent":0,
97+
"maxDiskCache":0,
98+
"totalDiskCache":0,
99+
"diskCachePercent":0,
100+
"maxMemory":0,
101+
"usedMemoy":0,
102+
"ramPercent":"0",
103+
"totalDisk":0,
104+
"usableDisk":0,
105+
"diskPercent":0
106+
};
107+
}
108+
92109
// CPU
93110

94111
let cpuValue = parseFloat(stats["gauges"]["server.runtime.cpu"].value);

0 commit comments

Comments
 (0)