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: add rows written to statement and transaction tables #70593

Merged
merged 1 commit into from
Sep 24, 2021

Conversation

lindseyjin
Copy link
Contributor

@lindseyjin lindseyjin commented Sep 22, 2021

Resolves #67084

Previously, the Statements and Transactions tables did not have a
"Rows Written" column. This was inadequate as we received feedback
to surface information on Rows Affected for statements on the db
console.

Since we've already added "Rows Written" as a metric on the Statement
Details pages, this commit also adds this metric as a column on the
Statements Overview table. This commit also adds this metric as a field
on the Transaction Statistics proto, in order to add this as a column
on the Transactions table and as a field on the Transaction Details page.
The table columns will not show up by default, although they are
selectable from the column selector.

Column Selector:
Screen Shot 2021-09-22 at 5 01 04 PM

Statements Overview table:
Screen Shot 2021-09-22 at 5 01 20 PM

Stats By Node table:
Screen Shot 2021-09-22 at 5 02 00 PM

Transactions table:
image

Transaction Details:
image

Release note (ui change): A new column, "Rows Written" has been added
onto the Statements and Transactions tables. This column will not show
up by default, but can be selected from the column selector. A new
metric "Mean rows written" has also been added to the Transaction
Details page.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

<Anchor href={statementsTimeInterval} target="_blank">
time interval
</Anchor>
. The gray bar indicates the mean number of rows written to disk.
Copy link
Contributor Author

@lindseyjin lindseyjin Sep 22, 2021

Choose a reason for hiding this comment

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

I noticed that other components split this text up into two paragraphs. However, it seems that there is no space after the period with that format, since the linter complains if you add a space.

image

Two solutions I've found around this are:

  1. adding a &nbsp after the period
  2. putting everything in one paragraph and adding a space after the period

image

Wondering if my current approach is fine, and if I should also apply this to the other tooltips? (or if it's not that important of an issue?)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer the &nbsp; approach with 2 paragraphs because it makes the description more clear.

@lindseyjin lindseyjin requested a review from a team September 22, 2021 21:09
let contentModifier = "";
const fingerprintModifier = "";
switch (statType) {
case "transaction":
Copy link
Contributor Author

Choose a reason for hiding this comment

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

question: should I remove this case if we're not supporting rowsWritten as a column on the Transactions page? Also, should I be adding this column onto the Transactions page, either in this PR or a future one?

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ianjevans, @lindseyjin, and @maryliag)


pkg/ui/workspaces/cluster-ui/src/barCharts/barCharts.tsx, line 38 at r2 (raw file):

const rowsWrittenBars = [
  bar("rows-written", (d: StatementStatistics) => d.stats.rows_written.mean),

since this is a new parameter, we should add the check here
d.stats.rows_written?.mean


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 299 at r1 (raw file):

Previously, lindseyjin (Lindsey Jin) wrote…

question: should I remove this case if we're not supporting rowsWritten as a column on the Transactions page? Also, should I be adding this column onto the Transactions page, either in this PR or a future one?

You should add the column on Transaction page, you can do it on this PR, so this case is still valid and shouldn't be removed from here


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 322 at r1 (raw file):

Previously, lindseyjin (Lindsey Jin) wrote…

I noticed that other components split this text up into two paragraphs. However, it seems that there is no space after the period with that format, since the linter complains if you add a space.

image

Two solutions I've found around this are:

  1. adding a &nbsp after the period
  2. putting everything in one paragraph and adding a space after the period

image

Wondering if my current approach is fine, and if I should also apply this to the other tooltips? (or if it's not that important of an issue?)

When you need to string to keep the spaces you can add the text inside {}. You can see in a few other places on the same file. So in your case you would have

</Anchor>
{" . The gray bar indicates the mean number of ro..."}

pkg/ui/workspaces/cluster-ui/src/util/docs.ts, line 64 at r1 (raw file):

Previously, lindseyjin (Lindsey Jin) wrote…

wondering if this is the right article to link, or if I should just keep the "readFromDisk" link?

@ianjevans can you confirm what is the appropriate doc for rows written? Thanks!

Copy link
Contributor Author

@lindseyjin lindseyjin 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 @ianjevans, @lindseyjin, and @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 299 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

You should add the column on Transaction page, you can do it on this PR, so this case is still valid and shouldn't be removed from here

hi, I realized that this change would involve adding a new field to the transactions proto, since in my last PR I only updated the statements proto. Would you still like me to do this in this PR?

Copy link
Contributor

@maryliag maryliag 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 @ianjevans, @lindseyjin, and @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 299 at r1 (raw file):

Previously, lindseyjin (Lindsey Jin) wrote…

hi, I realized that this change would involve adding a new field to the transactions proto, since in my last PR I only updated the statements proto. Would you still like me to do this in this PR?

Yes :)

@lindseyjin lindseyjin force-pushed the column-selector-rows-written branch 3 times, most recently from 1e3ab38 to ad5ff98 Compare September 23, 2021 21:41
@lindseyjin lindseyjin changed the title ui: add rows written to statements table and column selector ui: add rows written to statement and transaction tables Sep 23, 2021
@lindseyjin lindseyjin force-pushed the column-selector-rows-written branch 2 times, most recently from 5764046 to 48ac747 Compare September 23, 2021 22:26
Copy link
Contributor Author

@lindseyjin lindseyjin left a comment

Choose a reason for hiding this comment

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

Note: rebased on top of my other commit to fix tooltip text, although that should be merged into master soon! #70639

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ianjevans, @lindseyjin, and @maryliag)


pkg/ui/workspaces/cluster-ui/src/barCharts/barCharts.tsx, line 38 at r2 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

since this is a new parameter, we should add the check here
d.stats.rows_written?.mean

Done.

Copy link
Contributor Author

@lindseyjin lindseyjin 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 @ianjevans and @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 299 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

Yes :)

Done!

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

You can rebase with master now, since the other one was merged. This way this PR will have only one commit (currently still showing the other one here)

Reviewed 15 of 15 files at r4, 3 of 3 files at r5, 3 of 3 files at r6, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @lindseyjin)


pkg/sql/sqlstats/persistedsqlstats/sqlstatsutil/json_encoding_test.go, line 197 at r6 (raw file):

      "sqDiff": {{.Float}}
    }
		"rowsWritten": {

nit: this seems to have an extra space here, make sure it's aligned


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 304 at r6 (raw file):

      case "statement":
        contentModifier = contentModifiers.statements;
        break;

you need the case transactionDetails, which is the tooltip used on the statements table inside the transaction details page, which is why you need the fingerprintModifier parameter

@lindseyjin lindseyjin force-pushed the column-selector-rows-written branch 2 times, most recently from 634b2e9 to 4ebd600 Compare September 24, 2021 15:21
Copy link
Contributor Author

@lindseyjin lindseyjin 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 @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 304 at r6 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

you need the case transactionDetails, which is the tooltip used on the statements table inside the transaction details page, which is why you need the fingerprintModifier parameter

Done!

Although I was wondering how to view this on the UI? When I click into a transaction, the table only shows me one column (statements) with no column selector. Is that supposed to be the case?
image.png

Copy link
Contributor Author

@lindseyjin lindseyjin 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 @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 304 at r6 (raw file):

Previously, lindseyjin (Lindsey Jin) wrote…

Done!

Although I was wondering how to view this on the UI? When I click into a transaction, the table only shows me one column (statements) with no column selector. Is that supposed to be the case?
image.png

ooh also, should I update the transaction details to show mea rows written to be consistent with statement details?
image.png

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 3 files at r7, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @lindseyjin and @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 304 at r6 (raw file):

Previously, lindseyjin (Lindsey Jin) wrote…

ooh also, should I update the transaction details to show mea rows written to be consistent with statement details?
image.png

The majority of columns on Transaction Details is hidden because of an issue Archer is currently working on. Once that is resolved, the remaining columns will show, including the new one you just added :) This is why you need that other case

And yes, add the info to the transaction details under Transaction resource usage

Resolves cockroachdb#67084

Previously, the Statements and Transactions tables did not have a
"Rows Written" column. This was inadequate as we received feedback
to surface information on Rows Affected for statements on the db
console.

Since we've already added "Rows Written" as a metric on the Statement
Details pages, this commit also adds this metric as a column on the
Statements Overview table. This commit also adds this metric as a field
on the Transaction Statistics proto, in order to add this as a column
on the Transactions table and as a field on the Transaction Details page.
The table columns will not show up by default, although they are
selectable from the column selector.

Release note (ui change): A new column, "Rows Written" has been added
onto the Statements and Transactions tables. This column will not show
up by default, but can be selected from the column selector. A new
metric "Mean rows written" has also been added to the Transaction
Details page.
Copy link
Contributor Author

@lindseyjin lindseyjin 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 @ianjevans and @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 304 at r6 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

The majority of columns on Transaction Details is hidden because of an issue Archer is currently working on. Once that is resolved, the remaining columns will show, including the new one you just added :) This is why you need that other case

And yes, add the info to the transaction details under Transaction resource usage

Done.

Copy link
Contributor

@Azhng Azhng 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 @Azhng, @ianjevans, @lindseyjin, and @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 317 at r8 (raw file):

        style="tableTitle"
        content={
          <>

noob question: what's these empty <></> tags for?

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Awesome work! :lgtm:

Reviewed 1 of 3 files at r7, 2 of 2 files at r8, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @Azhng)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 317 at r8 (raw file):

Previously, Azhng (Archer Zhang) wrote…

noob question: what's these empty <></> tags for?

The tooltip component expects only one element for the content, so we add everything to one element, but we don't want to use any specific element, because they came with their respective styles, sizes etc, so we use the empty type, meaning it won't affect anything

Copy link
Contributor

@Azhng Azhng 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! 1 of 0 LGTMs obtained (waiting on @maryliag)


pkg/ui/workspaces/cluster-ui/src/statsTableUtil/statsTableUtil.tsx, line 317 at r8 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

The tooltip component expects only one element for the content, so we add everything to one element, but we don't want to use any specific element, because they came with their respective styles, sizes etc, so we use the empty type, meaning it won't affect anything

Ah I see! Thanks!

@lindseyjin
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Sep 24, 2021

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.

Surface the number affected rows in the DB console for statement statistics
5 participants