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 contention info to insight statement details #91668

Merged
merged 1 commit into from
Nov 15, 2022
Merged

ui: add contention info to insight statement details #91668

merged 1 commit into from
Nov 15, 2022

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Nov 10, 2022

This changes the crdb_internal.cluster_execution_insights to store
the names of contention key instead of
the ids. This avoids complex join logic so the
ui can display a eas format.

This does not currently contain the blocking
transaction fingerprint or the blocking statement
information. The blocking fingerprint will be added in issue #91665

closes: #91187

https://www.loom.com/share/03e08c5a473844b3a637b9eb618b7866

Release note (ui change): Add the contention
time, schema, database, table, and index info
to insights statement details page.

@j82w j82w requested review from a team November 10, 2022 14:38
@cockroach-teamcity
Copy link
Member

This change is Reviewable

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 10 of 10 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @j82w)


pkg/ui/workspaces/cluster-ui/src/api/insightsApi.ts line 665 at r1 (raw file):

  // We only surface the most recently observed problem for a given statement.
  query: `SELECT insight.*,
                 prettify_statement(non_prettified_query, 108, 2, 1) AS query

this value was change to 1 because of issue #91197. Using 2 could cause a problem, so you should keep the option 1 here


pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/insightDetailsTables.tsx line 147 at r1 (raw file):

  const columns = makeInsightStatementContentionColumns();
  return (
    <SortedTable className="statements-table" columns={columns} {...props} />

you're missing the props sortSetting and onChangeSortSetting. (which is also missing on the table above)

@j82w
Copy link
Contributor Author

j82w commented Nov 10, 2022

pkg/ui/workspaces/cluster-ui/src/api/insightsApi.ts line 665 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

this value was change to 1 because of issue #91197. Using 2 could cause a problem, so you should keep the option 1 here

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.

great!
just a few smaller changes, otherwise :lgtm:

Reviewed 2 of 4 files at r2, 1 of 1 files at r3, 7 of 7 files at r4, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @j82w)


pkg/sql/sqlstats/persistedsqlstats/sqlstatsutil/json_encoding.go line 304 at r4 (raw file):

//		    "schemaName":    { "type": "string" },
//		    "databaseName":  { "type": "string" },
//	      "tableName":     { "type": "string" },

nit: the alignment is wrong (probably a mix of spaces and tabs)


pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/statementInsightDetailsOverviewTab.tsx line 156 at r4 (raw file):

  if (insightDetails.contentionEvents != null) {
    contentionTable = (
      <Row>

you need some extra space at the bottom for smaller screens

<Row gutter={24} className={tableCx("margin-bottom")}>

@@ -64,6 +64,15 @@ export type TransactionInsightEventDetails = {
execType: InsightExecEnum;
};

export type InsightContentionEvent = {
Copy link
Member

Choose a reason for hiding this comment

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

Can we clarify this is for stmts right now? Since we have a BlockedContentionDetails for transactions already it can get a little confusing

Copy link
Member

Choose a reason for hiding this comment

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

Ideally we'd be able to merge the 2 in the future but I'm fine with keeping it separate right now since the other is based off the contention registry response

@j82w
Copy link
Contributor Author

j82w commented Nov 14, 2022

pkg/ui/workspaces/cluster-ui/src/insights/types.ts line 67 at r4 (raw file):

Previously, xinhaoz (Xin Hao Zhang) wrote…

Ideally we'd be able to merge the 2 in the future but I'm fine with keeping it separate right now since the other is based off the contention registry response

Sure, what about BlockedStatementContentionDetails?

Copy link
Contributor Author

@j82w j82w 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 (and 1 stale) (waiting on @maryliag and @xinhaoz)


pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/insightDetailsTables.tsx line 147 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

you're missing the props sortSetting and onChangeSortSetting. (which is also missing on the table above)

Done.


pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/statementInsightDetailsOverviewTab.tsx line 156 at r4 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

you need some extra space at the bottom for smaller screens

<Row gutter={24} className={tableCx("margin-bottom")}>

Done.

Copy link
Member

@xinhaoz xinhaoz 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 (and 1 stale) (waiting on @j82w and @maryliag)


pkg/ui/workspaces/cluster-ui/src/insights/types.ts line 67 at r4 (raw file):

Previously, j82w wrote…

Sure, what about BlockedStatementContentionDetails?

Sounds good to me!


pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/insightDetailsTables.tsx line 148 at r5 (raw file):

  InsightContentionTableProps
> = props => {
  const columns = makeInsightStatementContentionColumns();

Since this is actually creating the same object every time can we either lift this call out of the component or make the makeInsightStatementContentionColumns just an object instead of a func?

This changes the crdb_internal.cluster_execution_insights
to store the names of contention key instead of
the ids. This avoids complex join logic so the
ui can display a eas format.

This does not currently contain the blocking
transaction fingerprint or the blocking statement
information. The blocking fingerprint will be added
in issue #91665

closes: #91187

Release note (ui change): Add the contention
time, schema, database, table, and index info
to insights statement details page.
@j82w
Copy link
Contributor Author

j82w commented Nov 15, 2022

pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/insightDetailsTables.tsx line 148 at r5 (raw file):

Previously, xinhaoz (Xin Hao Zhang) wrote…

Since this is actually creating the same object every time can we either lift this call out of the component or make the makeInsightStatementContentionColumns just an object instead of a func?

Making it a const causes the dev ui watch initial page to not load. I'm going to leave it as a function for now. If there is a solution please create a github issue, and I'll do a follow up pr.
Uncaught TypeError: Cannot read properties of undefined (reading 'TRANSACTION')
at getLabel (main.js:519584:71)
at makeToolTip (main.js:519603:6)
at Object.executionID (main.js:519610:12)
at ./src/insights/workloadInsightDetails/insightDetailsTables.tsx (main.js:517641:87)

Copy link
Contributor Author

@j82w j82w 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 (and 1 stale) (waiting on @maryliag and @xinhaoz)


pkg/ui/workspaces/cluster-ui/src/insights/types.ts line 67 at r4 (raw file):

Previously, xinhaoz (Xin Hao Zhang) wrote…

Sounds good to me!

Done.

@j82w
Copy link
Contributor Author

j82w commented Nov 15, 2022

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 15, 2022

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.

insights: add statement contention events to ui
4 participants