-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 metrics Feature #7507
Add metrics Feature #7507
Changes from all commits
66f3cc8
be0028c
03a87f9
4401b17
fdff10a
8adebb6
ecd8af3
21df918
275a9f7
669e641
d439252
0339870
e725e41
d13c5fa
7e06047
afd64df
8e4774e
07b4e30
a8fd71e
e0040e1
9ff084a
fc463b7
1631184
a1b2f08
f858637
0e0b54b
0101d6a
5e6e6c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import { getFeature } from "@k8slens/feature-core"; | ||
import { clusterOverviewUIBlockInjectionToken, daemonSetDetailsMetricsInjectionToken, deploymentDetailsMetricsInjectionToken, jobDetailsMetricsInjectionToken, namespaceDetailsMetricsInjectionToken, ingressDetailsMetricsInjectionToken, nodeDetailsMetricsInjectionToken, persistentVolumeClaimDetailsMetricsInjectionToken, podDetailsContainerMetricsInjectionToken, podDetailsMetricsInjectionToken, replicaSetDetailsMetricsInjectionToken, statefulSetDetailsMetricsInjectionToken } from "@k8slens/metrics"; | ||
import { getInjectable } from "@ogre-tools/injectable"; | ||
import { ClusterMetrics } from "../../renderer/components/+cluster/cluster-metrics"; | ||
import { ClusterPieCharts } from "../../renderer/components/+cluster/cluster-pie-charts"; | ||
import { NamespaceMetricsDetailsComponent } from "../../renderer/components/+namespaces/metrics-details-component"; | ||
import { NodeMetricsDetailsComponent } from "../../renderer/components/+nodes/metrics-details-component"; | ||
import { PersistentVolumeClaimMetricsDetailsComponent } from "../../renderer/components/+storage-volume-claims/metrics-details-component"; | ||
import { DaemonSetMetricsDetailsComponent } from "../../renderer/components/+workloads-daemonsets/metrics-details-component"; | ||
import { DeploymentMetricsDetailsComponent } from "../../renderer/components/+workloads-deployments/metrics-details-component"; | ||
import { JobMetricsDetailsComponent } from "../../renderer/components/+workloads-jobs/metrics-details-component"; | ||
import { PodDetailsContainerMetrics } from "../../renderer/components/+workloads-pods/pod-details-container-metrics"; | ||
import PodMetricsDetailsComponent from "../../renderer/components/+workloads-pods/pod-metrics-details-component"; | ||
import { ReplicaSetMetricsDetailsComponent } from "../../renderer/components/+workloads-replicasets/metrics-details-component"; | ||
import { StatefulSetMetricsDetailsComponent } from "../../renderer/components/+workloads-statefulsets/metrics-details-component"; | ||
import { IngressMetricsDetailsComponent } from "../../renderer/components/+network-ingresses/metrics-details-component"; | ||
|
||
const clusterPieChartsClusterOverviewInjectable = getInjectable({ | ||
id: "cluster-pie-charts-cluster-overview", | ||
|
||
instantiate: () => ({ | ||
id: "cluster-pie-charts-cluster-overview", | ||
Component: ClusterPieCharts, | ||
orderNumber: 2, | ||
}), | ||
|
||
injectionToken: clusterOverviewUIBlockInjectionToken, | ||
}); | ||
|
||
const clusterMetricsOverviewBlockInjectable = getInjectable({ | ||
id: "cluster-metrics-overview-block", | ||
|
||
instantiate: () => ({ | ||
id: "cluster-metrics-overview-block", | ||
Component: ClusterMetrics, | ||
orderNumber: 1, | ||
}), | ||
|
||
injectionToken: clusterOverviewUIBlockInjectionToken, | ||
}); | ||
|
||
const podDetailsMetricsInjectable = getInjectable({ | ||
id: "pod-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "pod-details-metrics", | ||
Component: PodMetricsDetailsComponent, | ||
}), | ||
injectionToken: podDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const deploymentDetailsMetricsInjectable = getInjectable({ | ||
id: "deployment-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "deployment-details-metrics", | ||
Component: DeploymentMetricsDetailsComponent, | ||
}), | ||
injectionToken: deploymentDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const podDetailsContainerMetricsInjectable = getInjectable({ | ||
id: "pod-details-container-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "pod-details-container-metrics", | ||
Component: PodDetailsContainerMetrics, | ||
}), | ||
injectionToken: podDetailsContainerMetricsInjectionToken, | ||
}); | ||
|
||
const nodeDetailsMetricsInjectable = getInjectable({ | ||
id: "node-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "node-details-metrics", | ||
Component: NodeMetricsDetailsComponent, | ||
}), | ||
injectionToken: nodeDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const replicaSetDetailsMetricsInjectable = getInjectable({ | ||
id: "replica-set-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "replica-set-details-metrics", | ||
Component: ReplicaSetMetricsDetailsComponent, | ||
}), | ||
injectionToken: replicaSetDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const persistentVolumeClaimDetailsMetricsInjectable = getInjectable({ | ||
id: "persistent-volume-claim-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "persistent-volume-claim-details-metrics", | ||
Component: PersistentVolumeClaimMetricsDetailsComponent, | ||
}), | ||
injectionToken: persistentVolumeClaimDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const statefulSetDetailsMetricsInjectable = getInjectable({ | ||
id: "stateful-set-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "stateful-set-details-metrics", | ||
Component: StatefulSetMetricsDetailsComponent, | ||
}), | ||
injectionToken: statefulSetDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const namespaceDetailsMetricsInjectable = getInjectable({ | ||
id: "namespace-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "namespace-details-metrics", | ||
Component: NamespaceMetricsDetailsComponent, | ||
}), | ||
injectionToken: namespaceDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const jobDetailsMetricsInjectable = getInjectable({ | ||
id: "job-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "job-details-metrics", | ||
Component: JobMetricsDetailsComponent, | ||
}), | ||
injectionToken: jobDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const daemonSetDetailsMetricsInjectable = getInjectable({ | ||
id: "daemon-set-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "daemon-set-details-metrics", | ||
Component: DaemonSetMetricsDetailsComponent, | ||
}), | ||
injectionToken: daemonSetDetailsMetricsInjectionToken, | ||
}); | ||
|
||
const ingressDetailsMetricsInjectable = getInjectable({ | ||
id: "network-ingress-details-metrics-injectable", | ||
instantiate: () => ({ | ||
id: "network-ingress-details-metrics", | ||
Component: IngressMetricsDetailsComponent, | ||
}), | ||
injectionToken: ingressDetailsMetricsInjectionToken, | ||
}); | ||
|
||
export const metricsFeature = getFeature({ | ||
id: "core-metrics-feature", | ||
|
||
register: (di) => { | ||
di.register(clusterPieChartsClusterOverviewInjectable); | ||
di.register(clusterMetricsOverviewBlockInjectable); | ||
|
||
di.register(podDetailsMetricsInjectable); | ||
di.register(podDetailsContainerMetricsInjectable); | ||
di.register(deploymentDetailsMetricsInjectable); | ||
di.register(nodeDetailsMetricsInjectable); | ||
di.register(replicaSetDetailsMetricsInjectable); | ||
di.register(persistentVolumeClaimDetailsMetricsInjectable); | ||
di.register(statefulSetDetailsMetricsInjectable); | ||
di.register(namespaceDetailsMetricsInjectable); | ||
di.register(jobDetailsMetricsInjectable); | ||
di.register(daemonSetDetailsMetricsInjectable); | ||
di.register(ingressDetailsMetricsInjectable); | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,7 @@ import { interval } from "@k8slens/utilities"; | |
import { TabLayout } from "../layout/tab-layout"; | ||
import { Spinner } from "../spinner"; | ||
import { ClusterIssues } from "./cluster-issues"; | ||
import { ClusterMetrics } from "./cluster-metrics"; | ||
import type { ClusterOverviewStore } from "./cluster-overview-store/cluster-overview-store"; | ||
import { ClusterPieCharts } from "./cluster-pie-charts"; | ||
import { ClusterMetricsResourceType } from "../../../common/cluster-types"; | ||
import type { EventStore } from "../+events/store"; | ||
import { withInjectables } from "@ogre-tools/injectable-react"; | ||
|
@@ -28,6 +26,10 @@ import podStoreInjectable from "../+workloads-pods/store.injectable"; | |
import eventStoreInjectable from "../+events/store.injectable"; | ||
import nodeStoreInjectable from "../+nodes/store.injectable"; | ||
import enabledMetricsInjectable from "../../api/catalog/entity/metrics-enabled.injectable"; | ||
import type { ClusterOverviewUIBlock } from "@k8slens/metrics"; | ||
import { clusterOverviewUIBlockInjectionToken } from "@k8slens/metrics"; | ||
import { orderByOrderNumber } from "../../../common/utils/composable-responsibilities/orderable/orderable"; | ||
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx"; | ||
|
||
interface Dependencies { | ||
subscribeStores: SubscribeStores; | ||
|
@@ -36,6 +38,7 @@ interface Dependencies { | |
eventStore: EventStore; | ||
nodeStore: NodeStore; | ||
clusterMetricsAreVisible: IComputedValue<boolean>; | ||
uiBlocks: IComputedValue<ClusterOverviewUIBlock[]>; | ||
} | ||
|
||
@observer | ||
|
@@ -76,8 +79,9 @@ class NonInjectedClusterOverview extends React.Component<Dependencies> { | |
|
||
return ( | ||
<> | ||
<ClusterMetrics/> | ||
<ClusterPieCharts/> | ||
{orderByOrderNumber(this.props.uiBlocks.get()).map((block) => ( | ||
<block.Component key={block.id} /> | ||
))} | ||
</> | ||
); | ||
} | ||
|
@@ -118,5 +122,6 @@ export const ClusterOverview = withInjectables<Dependencies>(NonInjectedClusterO | |
podStore: di.inject(podStoreInjectable), | ||
eventStore: di.inject(eventStoreInjectable), | ||
nodeStore: di.inject(nodeStoreInjectable), | ||
uiBlocks: di.inject(computedInjectManyInjectable)(clusterOverviewUIBlockInjectionToken), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shout if you want There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That'd be useful! |
||
}), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No action required, this is also possible: