Fix: fix Kubernetes stats in v1.0.0 (#4984)

Co-authored-by: djeinstine <2105133+djeinstine@users.noreply.github.com>
pull/4988/head
shamoon 1 month ago committed by GitHub
parent 6e9339b14c
commit 65370a7668
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -71,8 +71,8 @@ export default async function handler(req, res) {
let depMem = 0;
let depCpu = 0;
const podMetrics = await metricsApi
.getPodMetrics(namespace, pod.metadata.name)
.then((response) => response)
.getPodMetrics(namespace, pod.items)
.then((response) => response.items)
.catch((err) => {
// 404 generally means that the metrics have not been populated yet
if (err.statusCode !== 404) {
@ -81,9 +81,11 @@ export default async function handler(req, res) {
return null;
});
if (podMetrics) {
podMetrics.containers.forEach((container) => {
depMem += parseMemory(container.usage.memory);
depCpu += parseCpu(container.usage.cpu);
podMetrics.forEach((metrics) => {
metrics.containers.forEach((container) => {
depMem += parseMemory(container.usage.memory);
depCpu += parseCpu(container.usage.cpu);
});
});
}
return {

Loading…
Cancel
Save