diff --git a/client/src/components/podCpuChart.tsx b/client/src/components/podCpuChart.tsx index cefab79..469158c 100644 --- a/client/src/components/podCpuChart.tsx +++ b/client/src/components/podCpuChart.tsx @@ -7,12 +7,14 @@ import {Pod, Metrics} from '../utils/types'; import PrometheusGraph, {BASE_HTTP_URL} from '../views/prometheusgraph'; import api from '../services/api'; -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 && } - +