mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Update Kubernetes resource attribute names for consistency
This commit is contained in:
@@ -34,7 +34,7 @@ export default class KubernetesResourceUtils {
|
||||
clusterIdentifier,
|
||||
metricName,
|
||||
resourceNameAttribute,
|
||||
namespaceAttribute = "resource.k8s.namespace.name",
|
||||
namespaceAttribute = "k8s.namespace.name",
|
||||
additionalAttributes = [],
|
||||
filterAttributes = {},
|
||||
hoursBack = 1,
|
||||
@@ -52,7 +52,7 @@ export default class KubernetesResourceUtils {
|
||||
time: new InBetween(startDate, endDate),
|
||||
name: metricName,
|
||||
attributes: {
|
||||
"resource.k8s.cluster.name": clusterIdentifier,
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
...filterAttributes,
|
||||
} as Dictionary<string | number | boolean>,
|
||||
},
|
||||
@@ -137,7 +137,7 @@ export default class KubernetesResourceUtils {
|
||||
time: new InBetween(startDate, endDate),
|
||||
name: options.memoryMetricName,
|
||||
attributes: {
|
||||
"resource.k8s.cluster.name": options.clusterIdentifier,
|
||||
"k8s.cluster.name": options.clusterIdentifier,
|
||||
...(options.filterAttributes || {}),
|
||||
} as Dictionary<string | number | boolean>,
|
||||
},
|
||||
@@ -163,7 +163,7 @@ export default class KubernetesResourceUtils {
|
||||
(attributes[options.resourceNameAttribute] as string) || "";
|
||||
const namespace: string =
|
||||
(attributes[
|
||||
options.namespaceAttribute || "resource.k8s.namespace.name"
|
||||
options.namespaceAttribute || "k8s.namespace.name"
|
||||
] as string) || "";
|
||||
const key: string = `${namespace}/${resourceName}`;
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ const KubernetesClusterContainers: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "container.cpu.utilization",
|
||||
memoryMetricName: "container.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.container.name",
|
||||
additionalAttributes: ["resource.k8s.pod.name"],
|
||||
resourceNameAttribute: "k8s.container.name",
|
||||
additionalAttributes: ["k8s.pod.name"],
|
||||
});
|
||||
|
||||
setResources(containerList);
|
||||
@@ -87,7 +87,7 @@ const KubernetesClusterContainers: FunctionComponent<
|
||||
columns={[
|
||||
{
|
||||
title: "Pod",
|
||||
key: "resource.k8s.pod.name",
|
||||
key: "k8s.pod.name",
|
||||
},
|
||||
]}
|
||||
getViewRoute={(resource: KubernetesResource) => {
|
||||
|
||||
@@ -84,7 +84,7 @@ const KubernetesClusterControlPlane: FunctionComponent<
|
||||
filterData: {
|
||||
metricName: "etcd_mvcc_db_total_size_in_bytes",
|
||||
attributes: {
|
||||
"resource.k8s.cluster.name": clusterIdentifier,
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -107,7 +107,7 @@ const KubernetesClusterControlPlane: FunctionComponent<
|
||||
filterData: {
|
||||
metricName: "apiserver_request_total",
|
||||
attributes: {
|
||||
"resource.k8s.cluster.name": clusterIdentifier,
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
},
|
||||
aggegationType: AggregationType.Sum,
|
||||
aggregateBy: {},
|
||||
@@ -130,7 +130,7 @@ const KubernetesClusterControlPlane: FunctionComponent<
|
||||
filterData: {
|
||||
metricName: "apiserver_request_duration_seconds",
|
||||
attributes: {
|
||||
"resource.k8s.cluster.name": clusterIdentifier,
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -153,7 +153,7 @@ const KubernetesClusterControlPlane: FunctionComponent<
|
||||
filterData: {
|
||||
metricName: "scheduler_pending_pods",
|
||||
attributes: {
|
||||
"resource.k8s.cluster.name": clusterIdentifier,
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -176,7 +176,7 @@ const KubernetesClusterControlPlane: FunctionComponent<
|
||||
filterData: {
|
||||
metricName: "scheduler_e2e_scheduling_duration_seconds",
|
||||
attributes: {
|
||||
"resource.k8s.cluster.name": clusterIdentifier,
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -199,7 +199,7 @@ const KubernetesClusterControlPlane: FunctionComponent<
|
||||
filterData: {
|
||||
metricName: "workqueue_depth",
|
||||
attributes: {
|
||||
"resource.k8s.cluster.name": clusterIdentifier,
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
|
||||
@@ -83,7 +83,7 @@ const KubernetesClusterCronJobDetail: FunctionComponent<
|
||||
const attributes: Record<string, unknown> =
|
||||
(data["attributes"] as Record<string, unknown>) || {};
|
||||
const podName: string =
|
||||
(attributes["resource.k8s.pod.name"] as string) || "Unknown Pod";
|
||||
(attributes["k8s.pod.name"] as string) || "Unknown Pod";
|
||||
return { title: podName };
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const KubernetesClusterCronJobDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.cronjob.name": cronJobName,
|
||||
"k8s.cronjob.name": cronJobName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -125,7 +125,7 @@ const KubernetesClusterCronJobDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.memory.usage",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.cronjob.name": cronJobName,
|
||||
"k8s.cronjob.name": cronJobName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
|
||||
@@ -53,7 +53,7 @@ const KubernetesClusterCronJobs: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
memoryMetricName: "k8s.pod.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.cronjob.name",
|
||||
resourceNameAttribute: "k8s.cronjob.name",
|
||||
});
|
||||
|
||||
setResources(cronjobList);
|
||||
|
||||
@@ -83,7 +83,7 @@ const KubernetesClusterDaemonSetDetail: FunctionComponent<
|
||||
const attributes: Record<string, unknown> =
|
||||
(data["attributes"] as Record<string, unknown>) || {};
|
||||
const podName: string =
|
||||
(attributes["resource.k8s.pod.name"] as string) || "Unknown Pod";
|
||||
(attributes["k8s.pod.name"] as string) || "Unknown Pod";
|
||||
return { title: podName };
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const KubernetesClusterDaemonSetDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.daemonset.name": daemonSetName,
|
||||
"k8s.daemonset.name": daemonSetName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -125,7 +125,7 @@ const KubernetesClusterDaemonSetDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.memory.usage",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.daemonset.name": daemonSetName,
|
||||
"k8s.daemonset.name": daemonSetName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
|
||||
@@ -53,7 +53,7 @@ const KubernetesClusterDaemonSets: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
memoryMetricName: "k8s.pod.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.daemonset.name",
|
||||
resourceNameAttribute: "k8s.daemonset.name",
|
||||
});
|
||||
|
||||
setResources(daemonsetList);
|
||||
|
||||
@@ -83,7 +83,7 @@ const KubernetesClusterDeploymentDetail: FunctionComponent<
|
||||
const attributes: Record<string, unknown> =
|
||||
(data["attributes"] as Record<string, unknown>) || {};
|
||||
const podName: string =
|
||||
(attributes["resource.k8s.pod.name"] as string) || "Unknown Pod";
|
||||
(attributes["k8s.pod.name"] as string) || "Unknown Pod";
|
||||
return { title: podName };
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const KubernetesClusterDeploymentDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.deployment.name": deploymentName,
|
||||
"k8s.deployment.name": deploymentName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -125,7 +125,7 @@ const KubernetesClusterDeploymentDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.memory.usage",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.deployment.name": deploymentName,
|
||||
"k8s.deployment.name": deploymentName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
|
||||
@@ -53,7 +53,7 @@ const KubernetesClusterDeployments: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
memoryMetricName: "k8s.pod.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.deployment.name",
|
||||
resourceNameAttribute: "k8s.deployment.name",
|
||||
});
|
||||
|
||||
setResources(deploymentList);
|
||||
|
||||
@@ -83,7 +83,7 @@ const KubernetesClusterJobDetail: FunctionComponent<
|
||||
const attributes: Record<string, unknown> =
|
||||
(data["attributes"] as Record<string, unknown>) || {};
|
||||
const podName: string =
|
||||
(attributes["resource.k8s.pod.name"] as string) || "Unknown Pod";
|
||||
(attributes["k8s.pod.name"] as string) || "Unknown Pod";
|
||||
return { title: podName };
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const KubernetesClusterJobDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.job.name": jobName,
|
||||
"k8s.job.name": jobName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -125,7 +125,7 @@ const KubernetesClusterJobDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.memory.usage",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.job.name": jobName,
|
||||
"k8s.job.name": jobName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
|
||||
@@ -53,7 +53,7 @@ const KubernetesClusterJobs: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
memoryMetricName: "k8s.pod.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.job.name",
|
||||
resourceNameAttribute: "k8s.job.name",
|
||||
});
|
||||
|
||||
setResources(jobList);
|
||||
|
||||
@@ -83,7 +83,7 @@ const KubernetesClusterNamespaceDetail: FunctionComponent<
|
||||
const attributes: Record<string, unknown> =
|
||||
(data["attributes"] as Record<string, unknown>) || {};
|
||||
const podName: string =
|
||||
(attributes["resource.k8s.pod.name"] as string) || "Unknown Pod";
|
||||
(attributes["k8s.pod.name"] as string) || "Unknown Pod";
|
||||
return { title: podName };
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const KubernetesClusterNamespaceDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.namespace.name": namespaceName,
|
||||
"k8s.namespace.name": namespaceName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -125,7 +125,7 @@ const KubernetesClusterNamespaceDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.memory.usage",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.namespace.name": namespaceName,
|
||||
"k8s.namespace.name": namespaceName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
|
||||
@@ -53,8 +53,8 @@ const KubernetesClusterNamespaces: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
memoryMetricName: "k8s.pod.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.namespace.name",
|
||||
namespaceAttribute: "resource.k8s.namespace.name",
|
||||
resourceNameAttribute: "k8s.namespace.name",
|
||||
namespaceAttribute: "k8s.namespace.name",
|
||||
});
|
||||
|
||||
setResources(namespaceList);
|
||||
|
||||
@@ -53,8 +53,8 @@ const KubernetesClusterNodes: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "k8s.node.cpu.utilization",
|
||||
memoryMetricName: "k8s.node.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.node.name",
|
||||
namespaceAttribute: "resource.k8s.node.name",
|
||||
resourceNameAttribute: "k8s.node.name",
|
||||
namespaceAttribute: "k8s.node.name",
|
||||
});
|
||||
|
||||
setResources(nodeList);
|
||||
|
||||
@@ -53,10 +53,10 @@ const KubernetesClusterPods: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
memoryMetricName: "k8s.pod.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.pod.name",
|
||||
resourceNameAttribute: "k8s.pod.name",
|
||||
additionalAttributes: [
|
||||
"resource.k8s.node.name",
|
||||
"resource.k8s.deployment.name",
|
||||
"k8s.node.name",
|
||||
"k8s.deployment.name",
|
||||
],
|
||||
});
|
||||
|
||||
@@ -90,7 +90,7 @@ const KubernetesClusterPods: FunctionComponent<
|
||||
columns={[
|
||||
{
|
||||
title: "Node",
|
||||
key: "resource.k8s.node.name",
|
||||
key: "k8s.node.name",
|
||||
},
|
||||
]}
|
||||
getViewRoute={(resource: KubernetesResource) => {
|
||||
|
||||
@@ -83,7 +83,7 @@ const KubernetesClusterStatefulSetDetail: FunctionComponent<
|
||||
const attributes: Record<string, unknown> =
|
||||
(data["attributes"] as Record<string, unknown>) || {};
|
||||
const podName: string =
|
||||
(attributes["resource.k8s.pod.name"] as string) || "Unknown Pod";
|
||||
(attributes["k8s.pod.name"] as string) || "Unknown Pod";
|
||||
return { title: podName };
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const KubernetesClusterStatefulSetDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.statefulset.name": statefulSetName,
|
||||
"k8s.statefulset.name": statefulSetName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
@@ -125,7 +125,7 @@ const KubernetesClusterStatefulSetDetail: FunctionComponent<
|
||||
metricName: "k8s.pod.memory.usage",
|
||||
attributes: {
|
||||
"k8s.cluster.name": clusterIdentifier,
|
||||
"resource.k8s.statefulset.name": statefulSetName,
|
||||
"k8s.statefulset.name": statefulSetName,
|
||||
},
|
||||
aggegationType: AggregationType.Avg,
|
||||
aggregateBy: {},
|
||||
|
||||
@@ -53,7 +53,7 @@ const KubernetesClusterStatefulSets: FunctionComponent<
|
||||
clusterIdentifier: cluster.clusterIdentifier,
|
||||
metricName: "k8s.pod.cpu.utilization",
|
||||
memoryMetricName: "k8s.pod.memory.usage",
|
||||
resourceNameAttribute: "resource.k8s.statefulset.name",
|
||||
resourceNameAttribute: "k8s.statefulset.name",
|
||||
});
|
||||
|
||||
setResources(statefulsetList);
|
||||
|
||||
Reference in New Issue
Block a user