-
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: add a sessions page #51903
ui: add a sessions page #51903
Conversation
This is amazing! I'm really excited we are tracking this information in the WebUI now. |
b2382c2
to
ff7b880
Compare
Here's a short video of the page in action: https://youtu.be/xPAtTGchPfo |
ff7b880
to
1289840
Compare
a71067e
to
ebd7f8f
Compare
Okay, this is ready for a review! |
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.
Thanks for putting this up @jordanlewis. My comments are mostly small nits. Nothing blocking except maybe the question re: pagination.
Reviewed 4 of 4 files at r1, 11 of 11 files at r2, 25 of 27 files at r3.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian, @jordanlewis, @nathanstilwell, and @solongordon)
pkg/ui/src/redux/sessions/sessionsSagas.tsx, line 76 at r3 (raw file):
} export function* terminateQuerySaga(action: PayloadAction<ICancelQueryRequest>) {
I still don't fully "get" how redux-saga works but I do like how this code reads! Really clear what's intended.
pkg/ui/src/views/sessions/sessionsPage.tsx, line 62 at r3 (raw file):
ascending: false, }, pagination: {
I'm unable to glean from the code where the pagination is being applied to the data in the table...am I missing something?
pkg/ui/src/views/sessions/sessionsPage.tsx, line 160 at r3 (raw file):
label: "Learn more", // TODO(jordan): point this to a more appropriate page. buttonHref: "https://www.cockroachlabs.com/docs/stable/show-sessions.html",
See pkg/ui/src/util/docs.ts
for docs link examples. We can generate the base of the docs URL there.
pkg/ui/src/views/sessions/terminateSessionModal.tsx, line 26 at r3 (raw file):
// tslint:disable-next-line:variable-name const TerminateSessionModal = (props: TerminateSessionModalProps, ref: React.RefObject<TerminateSessionModalRef>) => {
This whole pattern is a bit rough to read second time around. Thanks for lifting it from the diagnostics modal for now. I can't help but feel like there's a simplification that's possible here
cc @nathanstilwell, the diagnostics modal stuff was built quite quickly so I'm sure the modal pattern it implements could use a second look. Feels weird to be using these "refs" but maybe it's a valid pattern. Not sure how CC does it.
pkg/ui/src/views/statements/statementsTableContent.tsx, line 228 at r3 (raw file):
// StatementLinkTarget returns the link to the relevant statement page, given // the input statement details. export const StatementLinkTarget = (props: StatementLinkProps) => {
Thanks for improving this component!
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 @jordanlewis, @nathanstilwell, and @solongordon)
pkg/ui/src/views/sessions/sessionDetails.tsx, line 133 at r4 (raw file):
<div> <Link className={cx("back-link")} to={ "/sessions" }> Back to Statements
should say Sessions here?
ebd7f8f
to
eceac68
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.
TFTR!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian, @jordanlewis, @nathanstilwell, and @solongordon)
pkg/ui/src/redux/sessions/sessionsSagas.tsx, line 76 at r3 (raw file):
Previously, dhartunian (David Hartunian) wrote…
I still don't fully "get" how redux-saga works but I do like how this code reads! Really clear what's intended.
You and me both!
pkg/ui/src/views/sessions/sessionDetails.tsx, line 133 at r4 (raw file):
Previously, dhartunian (David Hartunian) wrote…
should say Sessions here?
Nice catch, fixed.
pkg/ui/src/views/sessions/sessionsPage.tsx, line 62 at r3 (raw file):
Previously, dhartunian (David Hartunian) wrote…
I'm unable to glean from the code where the pagination is being applied to the data in the table...am I missing something?
No, I just failed at cargo culting :) Thank you for noticing, I added the remaining plumbing.
pkg/ui/src/views/sessions/sessionsPage.tsx, line 160 at r3 (raw file):
Previously, dhartunian (David Hartunian) wrote…
See
pkg/ui/src/util/docs.ts
for docs link examples. We can generate the base of the docs URL there.
Done.
pkg/ui/src/views/sessions/terminateSessionModal.tsx, line 26 at r3 (raw file):
Previously, dhartunian (David Hartunian) wrote…
This whole pattern is a bit rough to read second time around. Thanks for lifting it from the diagnostics modal for now. I can't help but feel like there's a simplification that's possible here
cc @nathanstilwell, the diagnostics modal stuff was built quite quickly so I'm sure the modal pattern it implements could use a second look. Feels weird to be using these "refs" but maybe it's a valid pattern. Not sure how CC does it.
Yes, these refs are definitely interesting. I thought this is how one manages state. See the way I implemented the per-row actions popovers for a more interesting example - it definitely feels like a pattern, but an odd one.
ad77404
to
a114c49
Compare
bed017a
to
43106e0
Compare
Latest revision uses UUID format for the links, includes session ID in the session page, freezes the session page from updates, and fixes the remote debugging issues. |
Never mind, this was suggested later in the video. |
43106e0
to
8e9f6cc
Compare
Done. |
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 @dhartunian, @jordanlewis, and @nathanstilwell)
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.
By the way, I don't want this to block merging but it seems unideal that if you don't have CANCELQUERY permissions, trying to cancel a query or a session gives you a generic error when you click the link. Would be nicer to either not show the link or explain that you don't have the right privileges.
Same goes for if a non-admin tries to cancel an admin query/session.
I'd say let's just open an issue to track it.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian, @jordanlewis, and @nathanstilwell)
Add some new information to the transaction, session and query protobufs, and to the transactions internal tables. Release note (sql change): add 3 new columns to the crdb_internal.node_transactions and cluster_transactions tables: num_stmts, num_retries, and num_auto_retries. These keep track of the total number of statements executed on the transaction, the number of retries encountered, and the number of automatic retries encountered.
8e9f6cc
to
0e2e0b7
Compare
Thanks! That piece of feedback is already in the acceptance testing doc as it turns out: https://docs.google.com/document/d/1obahPF5wH_GbScPFtA3VUz-UjgqR7IRMCKRuT0JFen8/edit# I'll merge this now and make issues next. bors r+ |
51903: ui: add a sessions page r=jordanlewis a=jordanlewis This PR adds two new pages: 1. Active Sessions, a table of all active sessions in the database. 2. Session Details, a page with information about a single active session. In addition, active sessions and queries are now terminatable from the Active Sessions page. Release note (admin ui change): add the session list and session detail pages, and permit session and query termination from the UI. Closes #52193. Screenshots: ![image](https://user-images.githubusercontent.com/43821/88502972-35a4da00-cf9e-11ea-953d-b3ffff7b272e.png) ![image](https://user-images.githubusercontent.com/43821/88502982-3d647e80-cf9e-11ea-8801-d41461a635eb.png) ![image](https://user-images.githubusercontent.com/43821/88502986-42293280-cf9e-11ea-91b7-2435c129f158.png) Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
Build failed: |
bors r+ |
bors r- |
Canceled. |
bors r+ |
51903: ui: add a sessions page r=jordanlewis a=jordanlewis This PR adds two new pages: 1. Active Sessions, a table of all active sessions in the database. 2. Session Details, a page with information about a single active session. In addition, active sessions and queries are now terminatable from the Active Sessions page. Release note (admin ui change): add the session list and session detail pages, and permit session and query termination from the UI. Release justification: low risk, high benefit change to admin ui Closes #52193. Screenshots: ![image](https://user-images.githubusercontent.com/43821/88502972-35a4da00-cf9e-11ea-953d-b3ffff7b272e.png) ![image](https://user-images.githubusercontent.com/43821/88502982-3d647e80-cf9e-11ea-8801-d41461a635eb.png) ![image](https://user-images.githubusercontent.com/43821/88502986-42293280-cf9e-11ea-91b7-2435c129f158.png) Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
Build failed: |
This commit adds two new pages: 1. Active Sessions, a table of all active sessions in the database. 2. Session Details, a page with information about a single active session. In addition, active sessions and queries are now terminatable from the Active Sessions page. Release note (admin ui change): add the session list and session detail pages, and permit session and query termination from the UI.
Release note: None
Previously, running the list sessions or list local sessions APIs would require the remote debugging setting to be turned on. Now that we have role-based access controls for viewing session activity, this is no longer necessary. Release note: None Release justification: low-risk update to new functionality
0e2e0b7
to
91cc14f
Compare
bors r+ 🤞 |
Build succeeded: |
This PR adds two new pages:
session.
In addition, active sessions and queries are now terminatable from the
Active Sessions page.
Release note (admin ui change): add the session list and session detail
pages, and permit session and query termination from the UI.
Release justification: low risk, high benefit change to admin ui
Closes #52193.
Screenshots: