-
Notifications
You must be signed in to change notification settings - Fork 1
Replace StatsUpdater with multi-cluster aware ClusterHealthManager #374
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
base: master
Are you sure you want to change the base?
Conversation
I see tests are failing. I don't have time to fix those today. @alexdametto as you are away on Monday, please sanity check this PR today if you have time so I can fix up the tests and any issues you find on Monday. Thank you. |
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.
LGTM, just a couple of small proposals, nothing crazy 😁
@@ -39,7 +40,7 @@ function App() { | |||
|
|||
return ( | |||
<GcAdminAntdProvider> | |||
<StatsUpdater /> | |||
<ClusterHealthManager clusterId="" /> |
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.
I think here you are missing the clusterId
prop.
Note: another approach could be removing the parameter into the component and the component can get the cluster id from the context itself. Fine for me both ways.
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.
Oh but maybe the clusterId
prop is needed in cloud-ui to allow pre-fetch / multiple clusters, in that case ignore the comment above
const { data: nodes } = useClusterNodeStatus(clusterId); | ||
const [prevNodeData, setPrevNodesData] = useState<NodeStatusInfo[] | []>(); | ||
|
||
const getFs = (nodes: NodeStatusInfo[]): { [key: string]: FSStats } => { |
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.
I think that
const getFs = (nodes: NodeStatusInfo[]): { [key: string]: FSStats } => { | |
const getFs = (nodes: NodeStatusInfo[]): Record<string, FSStats> => { |
is more readable
fsStats: { [key: string]: FSStats }; | ||
|
||
// health | ||
clusterHealth: { [clusterId: string]: ClusterHealth }; |
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.
clusterHealth: { [clusterId: string]: ClusterHealth }; | |
clusterHealth: Record<string, ClusterHealth>; |
Summary of changes
☝️ In short, the old
StatsUpdater
worked, but was only aware of one cluster. This means when used incloud-ui
, and switching between clusters, cluster A's stats were mixed with cluster B's meaning none of the numbers are correct.cloud-ui
today. Stats would require the cluster being JWT compatible, however.ClusterHealthManager
but there were none forStatsUpdater
either. I think writing tests here will be very difficult as the component exports zero output. I am happy to try but I am not sure it is worth the effort at this time.Checklist
CHANGES.md
.