-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
ui: Network latency page improvements #103837
ui: Network latency page improvements #103837
Conversation
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. Before a member of our team reviews your PR, I have some potential action items for you:
I have added a few people who may be able to assist in reviewing:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
9e40a2d
to
c385254
Compare
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
сс @dongniwang I added video to show design changes. |
Great to see this! Drive-by comments, the red in the video for the decommissioned node is surprising to me. "red" means bad but decommissioned nodes are basically "not there", so if anything shouldn't they be greyed out or something like that? Also, can the tooltip make it clear which way the connection goes? This is something I'm always second guessing. There should be a clear Also want to x-post my comment from elsewhere, it would be great to surface the circuit breaker's connection error in the tooltip if the connection is in a failed state. |
c385254
to
85ac137
Compare
85ac137
to
c4960a8
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @koorosh)
pkg/ui/workspaces/db-console/src/redux/connectivity.ts
line 1 at r6 (raw file):
import { AdminUIState } from "src/redux/state";
you're getting a lint error here because you're missing the copyright header
cf97a99
to
6dffc91
Compare
Thank you for updating your pull request. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
4e48335
to
25fe356
Compare
25fe356
to
4bf14ca
Compare
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.
a few nits from me, otherwise the ui code
but I want to make sure you get an approval from @tbg before merging
Reviewed 9 of 14 files at r6, 12 of 12 files at r7, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @gtr, @j82w, @koorosh, @THardy98, @xinhaoz, and @zachlite)
pkg/ui/workspaces/db-console/src/views/reports/containers/network/latency/index.tsx
line 296 at r7 (raw file):
let showError = !!errorMessage; // Show errors for all connection statuses except ESTABLISHING status that treated exceptionally.
nit: ... status that is treated...
pkg/ui/workspaces/db-console/src/views/app/components/chip/styles.styl
line 42 at r7 (raw file):
&--white background $colors--neutral-0 border-color #c0c6d9
there is a color variable for this one that you can use: $colors--neutral-4
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.
Wonderful! I left a review on the Loom. The handling of decommissioned nodes looks like it will cause problems on real-world clusters. The rest is absolutely fantastic and I look forward to this hitting the world.
4bf14ca
to
e4c9a03
Compare
Thank you. I removed "Show dead nodes" option, so now we show only active nodes. |
@@ -113,17 +148,16 @@ export class Network extends React.Component<NetworkProps, INetworkState> { | |||
refresh(props = this.props) { |
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.
It looks like this function always uses this.props
. Can we remove the param and just use this.props
in the body?
if (!_.isEqual(this.props.location, prevProps.location)) { | ||
this.refresh(this.props); | ||
} | ||
componentDidUpdate(_prevProps: NetworkProps) { |
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.
We should avoid refreshing unconditionally in componentDidUpdate
moving forward (even if cacheddatareducer will implcity throttle these requests). Is there a better, more reliable way or place in the component to issue this refresh? Since this is already a widely used pattern with these db-console specific apis we can live it here for now if there's no alternative.
displayIdentities: Identity[], | ||
noConnections: NoConnection[], | ||
) { | ||
renderLatencyTable(latencies: number[], displayIdentities: Identity[]) { |
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.
Can this be lifted out into a separate component?
@@ -231,11 +259,9 @@ export class Network extends React.Component<NetworkProps, INetworkState> { | |||
const latencyTable = ( |
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.
Why define this component here instead of inlining it with the rest of the JSX?
.forEach(values => { | ||
const localities = searchQuery(values.locality).split(","); | ||
localities.forEach((locality: string) => { | ||
if (locality !== "") { |
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.
Suggestion:
if (locality === "") { return; }
... rest of the body
const value = locality.match(/^\w+/gi) | ||
? locality.match(/^\w+/gi)[0] | ||
: null; | ||
if (!sort.some(x => x.id === value)) { |
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.
Same here, change to:
if (sort.any(...)) { return; }
... rest
{latencyTable} | ||
</div> | ||
</Fragment> | ||
); | ||
} | ||
|
||
getSortParams = (data: Identity[]) => { |
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.
This function is quite lengthy with a lot of nested array processing, can you leave a comment summarizing what it's doing?
]; | ||
} else if ( | ||
itemLocalitySplited === value && | ||
!sortValue.filters.reduce( |
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.
would an any
work here?
); | ||
}), | ||
{React.Children.toArray( | ||
_.map(data, (value, index) => |
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.
nit: we should prefer native array functions for uniformity where applicable
e4c9a03
to
f7a97c6
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @gtr, @j82w, @maryliag, @THardy98, @xinhaoz, and @zachlite)
pkg/ui/workspaces/db-console/src/redux/connectivity.ts
line 1 at r6 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
you're getting a lint error here because you're missing the copyright header
Done.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/index.tsx
line 148 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
It looks like this function always uses
this.props
. Can we remove the param and just usethis.props
in the body?
Done.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/index.tsx
line 159 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
We should avoid refreshing unconditionally in
componentDidUpdate
moving forward (even if cacheddatareducer will implcity throttle these requests). Is there a better, more reliable way or place in the component to issue this refresh? Since this is already a widely used pattern with these db-console specific apis we can live it here for now if there's no alternative.
I tend to keep it as is to avoid potential regressions and avoid significant component refactoring in scope of this change.
This component isn't perfect at all and IMO needs lots of refactoring to be well structured and easy to maintain.
I created a separate #106244 to address such improvements.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/index.tsx
line 243 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
Can this be lifted out into a separate component?
Same as comment above. This component shares state so it's not just trivial extraction of pure component.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/index.tsx
line 259 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
Why define this component here instead of inlining it with the rest of the JSX?
It is used twice depending on condition, avoids code duplication.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/index.tsx
line 304 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
This function is quite lengthy with a lot of nested array processing, can you leave a comment summarizing what it's doing?
Definitely! 👍🏼
pkg/ui/workspaces/db-console/src/views/reports/containers/network/index.tsx
line 312 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
Suggestion:
if (locality === "") { return; } ... rest of the body
I like this! Done.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/index.tsx
line 316 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
Same here, change to:
if (sort.any(...)) { return; } ... rest
Done.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/index.tsx
line 338 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
would an
any
work here?
Done.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/latency/index.tsx
line 296 at r7 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
nit:
... status that is treated...
Thanks. Done.
pkg/ui/workspaces/db-console/src/views/reports/containers/network/latency/index.tsx
line 504 at r8 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
nit: we should prefer native array functions for uniformity where applicable
These components heavily use lodash in many places. Prefer to change it in scope of # #106244
pkg/ui/workspaces/db-console/src/views/app/components/chip/styles.styl
line 42 at r7 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
there is a color variable for this one that you can use:
$colors--neutral-4
Done.
- use connectivity endpoint as a source of connection statuses and latency; - remove popup with disconnected peers, instead it will be shown on latency matrix; Release note: None
f7a97c6
to
8e078fd
Compare
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.
bors r+ |
Build failed (retrying...): |
This PR was included in a batch that was canceled, it will be automatically retried |
Build succeeded: |
on latency matrix;
Resolves: #96101
Release note (ui change): add "Show dead nodes" option
to show/hide dead/decommissioned nodes from latency matrix.
Release note (ui change): "No connections" popup menu is removed. Now failed
connections are displayed on the latencies matrix.
This PR depends on following PRs that should be merged before this one:
example 1. one node cannot establish connection to another one.
example 2. Node 5 is stopped and it is considered as
unavailable
before setting asdead
example 3. Node 3 is dead. No connection from/to node. Show error message.
example 4. Decommissioned node.