release-22.2: ui: reduce frequent Metrics page re-rendering #89103
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.
Backport 1/1 commits from #88707 on behalf of @koorosh.
/cc @cockroachdb/release
Before, many components on Metrics page relied on
nodesSummarySelector
selector that in turn relies onNodeStatus
that change constantly with every request (and we request it periodically every 10 seconds).NodeStatus
include lots of unnecessary data for Metrics page (ie. node's and stores last metrics that aren't used on charts) but these changes forces react components to be re-rendered.This patch refactors selectors that are used by metrics page in a way to provide only relevant subset of NodeStatus's info
to Graph components and reduce propagation of
props
passing from parent to child components. Instead, use selectorsin child components if necessary.
Release note: None
Release justification: low risk, high benefit changes to existing functionality
Resolves #65030
Video that shows how often components were re-rendered before this fix - regardless of timewindow, it always
updates every 10 seconds:
metrics_page_refreshes_before_fix.mov
and here's after fix. Components re-render every 10 second for 10 minutes interval and it is not re-rendered
for timewindows like 2 weeks or 1 month:
metrics_page_refreshes_after_fix.mov
Release justification: