mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-04-22 09:16:35 +00:00
246: Update chart to reflect current pod cpu resources
Signed-off-by: Irene DeVera <idevera@indeed.com>
This commit is contained in:
@@ -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<Metrics>}) {
|
||||
export default function PodCpuChart({items, metrics, pod}: {items?: Pod[], metrics?: _.Dictionary<Metrics>, 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',
|
||||
|
||||
@@ -82,7 +82,7 @@ export default class PodView extends Base<Props, State> {
|
||||
{errors && !!errors.length && <Error messages={errors} />}
|
||||
|
||||
<ChartsContainer>
|
||||
<PodCpuChart items={item && [item]} metrics={filteredMetrics} />
|
||||
<PodCpuChart items={item && [item]} metrics={filteredMetrics} pod={item}/>
|
||||
<PodRamChart items={item && [item]} metrics={filteredMetrics} />
|
||||
</ChartsContainer>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user