From a035eeb83614cf95ca4e586a5fb45beb8a43221e Mon Sep 17 00:00:00 2001 From: Irene DeVera Date: Wed, 25 Aug 2021 13:38:13 -0700 Subject: [PATCH 1/2] 246: Update chart to reflect current pod cpu resources Signed-off-by: Irene DeVera --- client/src/components/podCpuChart.tsx | 8 ++++++-- client/src/views/pod.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/components/podCpuChart.tsx b/client/src/components/podCpuChart.tsx index 722b3fb..d548d2d 100644 --- a/client/src/components/podCpuChart.tsx +++ b/client/src/components/podCpuChart.tsx @@ -6,11 +6,15 @@ import {parseCpu, TO_ONE_CPU} from '../utils/unitHelpers'; import {Pod, Metrics} from '../utils/types'; import PrometheusGraph from '../views/prometheusgraph'; -export default function PodCpuChart({items, metrics}: {items?: Pod[], metrics?: _.Dictionary}) { +export default function PodCpuChart({items, metrics, pod}: {items?: Pod[], metrics?: _.Dictionary, pod?: Pod}) { const totals = getPodCpuTotals(items, metrics); // const decimals = totals && totals.used > 10 ? 1 : 2; + + const defaultLabels = "unit='core', resource='cpu'"; + const labelMatchers = pod ? `${defaultLabels}, pod="${pod.metadata.name}"` : defaultLabels; + const query = { - queryString: 'sum(kube_pod_container_resource_requests{unit="core", resource="cpu"})', + queryString: `sum(kube_pod_container_resource_requests{${labelMatchers}})`, title: 'Pod CPU Usage', yAxisMin: 0, yAxisUnit: 'CPU', diff --git a/client/src/views/pod.tsx b/client/src/views/pod.tsx index b7eea89..0183c01 100644 --- a/client/src/views/pod.tsx +++ b/client/src/views/pod.tsx @@ -82,7 +82,7 @@ export default class PodView extends Base { {errors && !!errors.length && } - + From cb09c76c57763b327afb2905ee82ed41b76f4703 Mon Sep 17 00:00:00 2001 From: Irene DeVera Date: Wed, 25 Aug 2021 14:15:07 -0700 Subject: [PATCH 2/2] 246: Update Ram chart for each pod Signed-off-by: Irene DeVera --- client/src/components/podRamChart.tsx | 7 +++++-- client/src/views/pod.tsx | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/components/podRamChart.tsx b/client/src/components/podRamChart.tsx index f9fe6f7..3ce3160 100644 --- a/client/src/components/podRamChart.tsx +++ b/client/src/components/podRamChart.tsx @@ -5,11 +5,14 @@ import {parseRam, TO_GB} from '../utils/unitHelpers'; import {Pod, Metrics} from '../utils/types'; import PrometheusGraph from '../views/prometheusgraph'; -export default function RamChart({items, metrics}: {items?: Pod[], metrics?: _.Dictionary}) { +export default function RamChart({items, metrics, pod}: {items?: Pod[], metrics?: _.Dictionary, pod?: Pod}) { const totals = getPodRamTotals(items, metrics); + const defaultLabels = "unit='byte'"; + const labelMatchers = pod ? `${defaultLabels}, pod="${pod.metadata.name}"` : defaultLabels; + const query = { - queryString: `sum(kube_pod_container_resource_requests{unit="byte"}/${TO_GB})`, + queryString: `sum(kube_pod_container_resource_requests{${labelMatchers}}/${TO_GB})`, title: 'Pod Memory Usage', yAxisMin: 0, yAxisUnit: 'GiB', diff --git a/client/src/views/pod.tsx b/client/src/views/pod.tsx index 0183c01..595a2fc 100644 --- a/client/src/views/pod.tsx +++ b/client/src/views/pod.tsx @@ -83,7 +83,7 @@ export default class PodView extends Base { - +