-
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
Merged
Merged
Add metrics Feature #7507
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
66f3cc8
Add cluster UI block injection token and current implementation as a …
jweak be0028c
Add pod details metrics injection token.
jweak 03a87f9
Extract pod container metrics to its own injection token.
jweak 4401b17
Add deployment details metrics injection token
jweak fdff10a
Add node details metrics injection token.
jweak 8adebb6
Add replicaset details metrics injection token.
jweak ecd8af3
Add persistent volume claim details metrics injection token.
jweak 21df918
Refactor repeating code into a separate function.
jweak 275a9f7
Add stateful set details metrics injection token.
jweak 669e641
Add namespace details metrics injection token.
jweak d439252
Rename details injectables file suffixes from tsx to ts
jweak 0339870
Add job details metrics injection token.
jweak e725e41
Add daemonset details metrics injection token.
jweak d13c5fa
Add ingress details metrics injection token.
jweak 7e06047
Remove duplicate package import
jweak afd64df
Update package-lock.json
jweak 8e4774e
Update metrics package description
jweak 07b4e30
Remove unnecessary variable from init containers component
jweak a8fd71e
Add missing packages to metrics package.json
jweak e0040e1
Merge branch 'master' into metrics-extraction
jweak 9ff084a
Lint fixes after changed prettier config
jweak fc463b7
Update package-lock.json
jweak 1631184
Make Cluster overview UI blocks computed value
jweak a1b2f08
Merge branch 'master' into metrics-extraction
jweak f858637
Add comment for moving ui blocks to own package
jweak 0e0b54b
Make details metrics a computed value.
jweak 0101d6a
Merge branch 'master' into metrics-extraction
jweak 5e6e6c0
Merge branch 'master' into metrics-extraction
jweak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...object-details/kube-object-detail-items/metrics/deployment-details-metrics.injectable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import { getInjectable } from "@ogre-tools/injectable"; | ||
import { ClusterMetricsResourceType } from "../../../../../common/cluster-types"; | ||
import metricsDetailsComponentEnabledInjectable from "../../../../api/catalog/entity/metrics-details-component-enabled.injectable"; | ||
import { kubeObjectDetailItemInjectionToken } from "../kube-object-detail-item-injection-token"; | ||
import { deploymentDetailsMetricsInjectionToken } from "@k8slens/metrics"; | ||
import { EmptyMetrics } from "./empty-metrics"; | ||
|
||
const deploymentMetricsInjectable = getInjectable({ | ||
id: "deployment-details-metrics", | ||
instantiate: (di) => { | ||
const deploymentMetrics = di.injectMany(deploymentDetailsMetricsInjectionToken); | ||
const first = deploymentMetrics[0]; | ||
|
||
const Component = first?.Component ?? EmptyMetrics; | ||
|
||
return { | ||
Component, | ||
enabled: di.inject(metricsDetailsComponentEnabledInjectable, ClusterMetricsResourceType.Deployment), | ||
orderNumber: -1, | ||
}; | ||
}, | ||
injectionToken: kubeObjectDetailItemInjectionToken, | ||
}); | ||
|
||
export default deploymentMetricsInjectable; |
7 changes: 7 additions & 0 deletions
7
...enderer/components/kube-object-details/kube-object-detail-items/metrics/empty-metrics.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import React from "react"; | ||
|
||
export const EmptyMetrics = () => <></>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,22 +2,20 @@ | |
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import React from "react"; | ||
import { podDetailsMetricsInjectionToken } from "@k8slens/metrics"; | ||
import { getInjectable } from "@ogre-tools/injectable"; | ||
import { ClusterMetricsResourceType } from "../../../../common/cluster-types"; | ||
import metricsDetailsComponentEnabledInjectable from "../../../api/catalog/entity/metrics-details-component-enabled.injectable"; | ||
import { kubeObjectDetailItemInjectionToken } from "./kube-object-detail-item-injection-token"; | ||
|
||
const Empty = () => <></>; | ||
import { ClusterMetricsResourceType } from "../../../../../common/cluster-types"; | ||
import metricsDetailsComponentEnabledInjectable from "../../../../api/catalog/entity/metrics-details-component-enabled.injectable"; | ||
import { kubeObjectDetailItemInjectionToken } from "../kube-object-detail-item-injection-token"; | ||
import { EmptyMetrics } from "./empty-metrics"; | ||
|
||
const podMetricsInjectable = getInjectable({ | ||
id: "kube-object-pod-metrics-injectable", | ||
id: "pod-details-pod-metrics", | ||
instantiate: (di) => { | ||
const podMetrics = di.injectMany(podDetailsMetricsInjectionToken); | ||
const first = podMetrics[0]; | ||
|
||
const Component = first ?? Empty; | ||
const Component = first?.Component ?? EmptyMetrics; | ||
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. Could we instead register |
||
|
||
return { | ||
Component, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: