Skip to content
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: set overview page node list data with stale tag if node is dead #95868

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

iAaronBuck
Copy link
Contributor

@iAaronBuck iAaronBuck commented Jan 25, 2023

71618: ui: set overview page node list data with stale tag if node is dead

Screen Shot 2023-01-25 at 4 25 17 PM

Issue: #71618
Epic: None

Release note (ui change): Currently, the stale node metrics displayed to a user in the Cluster Overview Nodes Table may mislead users in to thinking that they are current values when in fact they are stale. This change rectifies that and adds a stale tag to metrics displayed to the user. This allows for users to be informed about the staleness of the data displayed to them regarding dead nodes.

@iAaronBuck iAaronBuck requested review from rickystewart, zachlite and a team January 25, 2023 21:29
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@zachlite zachlite removed the request for review from rickystewart January 25, 2023 21:35
Copy link
Contributor

@zachlite zachlite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice first PR! I appreciate the description and the screenshot!
See my comments below.
Additionally, there should be a Release Note since we've made a user-facing UI change.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @iAaronBuck)


-- commits line 2 at r1:
Nit: Commit messages should provide an indication of the changes made in the commit.


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 271 at r1 (raw file):

      key: "uptime",
      dataIndex: "uptime",
      render: (_text: string, record: NodeStatusRow) =>

Rather than repeat this logic a few times, you could write a function:
formatWithPossibleStaleIndicator(value: string, status: AggregatedNodeStatus | LivenessStatus): string


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 272 at r1 (raw file):

      dataIndex: "uptime",
      render: (_text: string, record: NodeStatusRow) =>
        _text +

Nit: use string interpolation with ${} instead of concatenating with +
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#string_interpolation

@iAaronBuck iAaronBuck force-pushed the staleNodeListTag branch 5 times, most recently from 9fe488c to dc3bc06 Compare January 26, 2023 19:29
Copy link
Contributor Author

@iAaronBuck iAaronBuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions!

I have implemented them and hope that this amendment is good to go.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @zachlite)


-- commits line 2 at r1:

Previously, zachlite wrote…

Nit: Commit messages should provide an indication of the changes made in the commit.

Thanks for pointing this out, I'll be sure to put the commit message in the proper place next time, rather than just as a comment in the PR itself.


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 271 at r1 (raw file):

Previously, zachlite wrote…

Rather than repeat this logic a few times, you could write a function:
formatWithPossibleStaleIndicator(value: string, status: AggregatedNodeStatus | LivenessStatus): string

I implemented a change along the lines of your suggestion. The second value is sent to render with type NodeStatusRow, so I was not able to set it to type AggregatedNodeStatus | LivenessStatus as suggested. Please let me know if this is fine.


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 272 at r1 (raw file):

Previously, zachlite wrote…

Nit: use string interpolation with ${} instead of concatenating with +
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#string_interpolation

Thanks for the suggestion! I have implemented it.

Copy link
Contributor

@zachlite zachlite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

displayed to the user, as shown below.

The release notes get parsed and go into auto-generated documentation, so the "as shown below" reference won't make any sense when someone comes across your comment in the release notes.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @iAaronBuck)


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 225 at r3 (raw file):

  text: string,
  record: NodeStatusRow,
): string => `${text}${getStaleIndicator(record.status)}`;

Nit: I don't like getStaleIndicator returning an empty string. This seems unnecessary.
Try this:

// formatWithPossibleStatusIndicator

if (status.NODE_STATUS_DEAD || status.DEAD) {
  return `${text} (stale)`;
}

return text;

pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 293 at r3 (raw file):

      ),
      render: (_text: string, record: NodeStatusRow) =>
        util.Percentage(record.usedCapacity, record.availableCapacity),

You still need this

@iAaronBuck iAaronBuck force-pushed the staleNodeListTag branch 2 times, most recently from d44b118 to ede4227 Compare January 26, 2023 22:01
Copy link
Contributor Author

@iAaronBuck iAaronBuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @zachlite)


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 225 at r3 (raw file):

if (status.NODE_STATUS_DEAD || status.DEAD) {
return ${text} (stale);
}

return text;
Thanks for your suggestion. I implemented it.


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 293 at r3 (raw file):

Previously, zachlite wrote…

You still need this

ty, I brought it back.

Copy link
Contributor

@zachlite zachlite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

See my latest comments before you merge.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @iAaronBuck)


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 282 at r5 (raw file):

      key: "uptime",
      dataIndex: "uptime",
      render: formatWithPossibleStaleIndicator,

Since you added a render fn, you can remove this.


pkg/ui/workspaces/db-console/src/views/cluster/containers/nodesOverview/index.tsx line 291 at r5 (raw file):

    {
      key: "replicas",
      dataIndex: "replicas",

Same.

@iAaronBuck iAaronBuck force-pushed the staleNodeListTag branch 3 times, most recently from 801bf22 to e279349 Compare January 27, 2023 20:03
@iAaronBuck
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 27, 2023

🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

@craig
Copy link
Contributor

craig bot commented Jan 27, 2023

GitHub status checks took too long to complete, so bors is giving up. You can adjust bors configuration to have it wait longer if you like.

… dead

Issue: cockroachdb#71618
Epic: None

Release note (ui change): Currently, the stale node metrics displayed to a
user in the Cluster Overview Nodes Table may mislead users in to thinking
that they are current values when in fact they are stale. This change
rectifies that and adds a stale tag to metrics displayed to the user.
This allows for users to be informed about the staleness of the data
displayed to them regarding dead nodes.
@iAaronBuck
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 2, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Feb 3, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants