Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more file system metrics to the pod and container graphs #3961

Merged
merged 1 commit into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/common/k8s-api/endpoints/daemon-set.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ export function getMetricsForDaemonSets(daemonsets: DaemonSet[], namespace: stri
cpuUsage: opts,
memoryUsage: opts,
fsUsage: opts,
fsWrites: opts,
fsReads: opts,
networkReceive: opts,
networkTransmit: opts,
}, {
Expand Down
2 changes: 2 additions & 0 deletions src/common/k8s-api/endpoints/deployment.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export function getMetricsForDeployments(deployments: Deployment[], namespace: s
cpuUsage: opts,
memoryUsage: opts,
fsUsage: opts,
fsWrites: opts,
fsReads: opts,
networkReceive: opts,
networkTransmit: opts,
}, {
Expand Down
2 changes: 2 additions & 0 deletions src/common/k8s-api/endpoints/job.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export function getMetricsForJobs(jobs: Job[], namespace: string, selector = "")
cpuUsage: opts,
memoryUsage: opts,
fsUsage: opts,
fsWrites: opts,
fsReads: opts,
networkReceive: opts,
networkTransmit: opts,
}, {
Expand Down
2 changes: 2 additions & 0 deletions src/common/k8s-api/endpoints/metrics.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export interface IResourceMetrics<T extends IMetrics> {
cpuUsage: T;
memoryUsage: T;
fsUsage: T;
fsWrites: T;
fsReads: T;
networkReceive: T;
networkTransmit: T;
}
Expand Down
2 changes: 2 additions & 0 deletions src/common/k8s-api/endpoints/namespaces.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export function getMetricsForNamespace(namespace: string, selector = ""): Promis
cpuUsage: opts,
memoryUsage: opts,
fsUsage: opts,
fsWrites: opts,
fsReads: opts,
networkReceive: opts,
networkTransmit: opts,
}, {
Expand Down
6 changes: 5 additions & 1 deletion src/common/k8s-api/endpoints/pods.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export function getMetricsForPods(pods: Pod[], namespace: string, selector = "po
memoryRequests: opts,
memoryLimits: opts,
fsUsage: opts,
fsWrites: opts,
fsReads: opts,
networkReceive: opts,
networkTransmit: opts,
}, {
Expand All @@ -57,7 +59,9 @@ export interface IPodMetrics<T = IMetrics> {
[metric: string]: T;
cpuUsage: T;
memoryUsage: T;
fsUsage: T;
fsUsage: T,
fsWrites: T,
fsReads: T,
networkReceive: T;
networkTransmit: T;
cpuRequests?: T;
Expand Down
2 changes: 2 additions & 0 deletions src/common/k8s-api/endpoints/replica-set.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export function getMetricsForReplicaSets(replicasets: ReplicaSet[], namespace: s
cpuUsage: opts,
memoryUsage: opts,
fsUsage: opts,
fsWrites: opts,
fsReads: opts,
networkReceive: opts,
networkTransmit: opts,
}, {
Expand Down
2 changes: 2 additions & 0 deletions src/common/k8s-api/endpoints/stateful-set.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export function getMetricsForStatefulSets(statefulSets: StatefulSet[], namespace
cpuUsage: opts,
memoryUsage: opts,
fsUsage: opts,
fsWrites: opts,
fsReads: opts,
networkReceive: opts,
networkTransmit: opts,
}, {
Expand Down
4 changes: 4 additions & 0 deletions src/main/prometheus/lens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export class PrometheusLens extends PrometheusProvider {
return `sum(kube_pod_container_resource_limits{pod=~"${opts.pods}",resource="memory",namespace="${opts.namespace}"}) by (${opts.selector})`;
case "fsUsage":
return `sum(container_fs_usage_bytes{container!="POD",container!="",pod=~"${opts.pods}",namespace="${opts.namespace}"}) by (${opts.selector})`;
case "fsWrites":
return `sum(rate(container_fs_writes_bytes_total{container!="", pod=~"${opts.pods}", namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "fsReads":
return `sum(rate(container_fs_reads_bytes_total{container!="", pod=~"${opts.pods}", namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "networkReceive":
return `sum(rate(container_network_receive_bytes_total{pod=~"${opts.pods}",namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "networkTransmit":
Expand Down
4 changes: 4 additions & 0 deletions src/main/prometheus/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export class PrometheusOperator extends PrometheusProvider {
return `sum(kube_pod_container_resource_limits{pod=~"${opts.pods}", resource="memory", namespace="${opts.namespace}"}) by (${opts.selector})`;
case "fsUsage":
return `sum(container_fs_usage_bytes{container!="", pod=~"${opts.pods}", namespace="${opts.namespace}"}) by (${opts.selector})`;
case "fsWrites":
return `sum(rate(container_fs_writes_bytes_total{container!="", pod=~"${opts.pods}", namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "fsReads":
return `sum(rate(container_fs_reads_bytes_total{container!="", pod=~"${opts.pods}", namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "networkReceive":
return `sum(rate(container_network_receive_bytes_total{pod=~"${opts.pods}", namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "networkTransmit":
Expand Down
4 changes: 4 additions & 0 deletions src/main/prometheus/stacklight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export class PrometheusStacklight extends PrometheusProvider {
return `sum(kube_pod_container_resource_limits{pod=~"${opts.pods}",resource="memory",namespace="${opts.namespace}"}) by (${opts.selector})`;
case "fsUsage":
return `sum(container_fs_usage_bytes{container!="POD",container!="",pod=~"${opts.pods}",namespace="${opts.namespace}"}) by (${opts.selector})`;
case "fsWrites":
return `sum(rate(container_fs_writes_bytes_total{container!="", pod=~"${opts.pods}", namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "fsReads":
return `sum(rate(container_fs_reads_bytes_total{container!="", pod=~"${opts.pods}", namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "networkReceive":
return `sum(rate(container_network_receive_bytes_total{pod=~"${opts.pods}",namespace="${opts.namespace}"}[${this.rateAccuracy}])) by (${opts.selector})`;
case "networkTransmit":
Expand Down
16 changes: 16 additions & 0 deletions src/renderer/components/+workloads-pods/container-charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const ContainerCharts = observer(() => {
memoryRequests,
memoryLimits,
fsUsage,
fsWrites,
fsReads
} = mapValues(metrics, metric => normalizeMetrics(metric).data.result[0].values);

const datasets = [
Expand Down Expand Up @@ -106,6 +108,20 @@ export const ContainerCharts = observer(() => {
borderColor: "#ffc63d",
data: fsUsage.map(([x, y]) => ({ x, y })),
},
{
id: "fsWrites",
label: `Writes`,
tooltip: `Bytes written on this filesystem`,
borderColor: "#ff963d",
data: fsWrites.map(([x, y]) => ({ x, y })),
},
{
id: "fsReads",
label: `Reads`,
tooltip: `Bytes read on this filesystem`,
borderColor: "#fff73d",
data: fsReads.map(([x, y]) => ({ x, y })),
},
],
];

Expand Down
16 changes: 16 additions & 0 deletions src/renderer/components/+workloads-pods/pod-charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export const PodCharts = observer(() => {
cpuUsage,
memoryUsage,
fsUsage,
fsWrites,
fsReads,
networkReceive,
networkTransmit,
} = mapValues(metrics, metric => normalizeMetrics(metric).data.result[0].values);
Expand Down Expand Up @@ -102,6 +104,20 @@ export const PodCharts = observer(() => {
borderColor: "#ffc63d",
data: fsUsage.map(([x, y]) => ({ x, y })),
},
{
id: `${id}-fsWrites`,
label: `Writes`,
tooltip: `Bytes written on this filesystem`,
borderColor: "#ff963d",
data: fsWrites.map(([x, y]) => ({ x, y })),
},
{
id: `${id}-fsReads`,
label: `Reads`,
tooltip: `Bytes read on this filesystem`,
borderColor: "#fff73d",
data: fsReads.map(([x, y]) => ({ x, y })),
},
],
];

Expand Down