-
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
distsql, sql, ui: update SQL metrics #12299
Conversation
Looks mostly good to me. @andreimatei should look at the changes to the txn retry code. Review status: 0 of 10 files reviewed at latest revision, 3 unresolved discussions, all commit checks successful. pkg/sql/metric_test.go, line 41 at r1 (raw file):
is there a test where pkg/sql/metric_test.go, line 235 at r1 (raw file):
So, the semantics of the pkg/ui/app/containers/nodeGraphs.tsx, line 104 at r1 (raw file):
Comments from Reviewable |
I think it'd be nice if we could use different dimensions of a metric to count different related things. For example, ideally, distsql/classic would be one dimension of the statements metric. original/auto-retry/user-directed-retry would be another dimension. @mrtracy, our metrics don't support having multiple dimensions, do they? Review status: 0 of 10 files reviewed at latest revision, 10 unresolved discussions, all commit checks successful. pkg/internal/client/txn.go, line 482 at r1 (raw file):
mmm do we really need to add this param to this core interface that just one client needs? That one client can capture a variable from the outer scope, just like it does for a bunch of other stuff. pkg/sql/executor.go, line 199 at r1 (raw file):
comment whether the two overlap or not. As I've said below, I think the first should be a super-set of the 2nd. pkg/sql/executor.go, line 978 at r1 (raw file):
well so the way you wrote the code, pkg/sql/executor.go, line 1340 at r1 (raw file):
nit: i'd have the parent not call this on retries pkg/sql/executor.go, line 1350 at r1 (raw file):
I think it's very unfortunate to start counting these things in different places. How about we count selects here just like everything else (and so a select would always be counted), and we just count the distsql metric separately. pkg/sql/metric_test.go, line 115 at r1 (raw file):
well if you're giving this test some love, how about changing it to the use sub-tests and checking the delta between current value and the value at the beginning on the sub-test, instead of doing this early fail? pkg/sql/metric_test.go, line 184 at r1 (raw file):
superfluous change? same below pkg/sql/metric_test.go, line 235 at r1 (raw file): Previously, cuongdo (Cuong Do) wrote…
yeah, how did this change? Comments from Reviewable |
@@ -478,7 +478,9 @@ func (e *AutoCommitError) Error() string { | |||
// to clean up the transaction before returning an error. In case of | |||
// TransactionAbortedError, txn is reset to a fresh transaction, ready to be | |||
// used. | |||
func (txn *Txn) Exec(opt TxnExecOptions, fn func(txn *Txn, opt *TxnExecOptions) error) (err error) { | |||
func (txn *Txn) Exec( | |||
opt TxnExecOptions, fn func(txn *Txn, opt *TxnExecOptions, isRetry bool) error, |
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 you make isRetry a part of the TxnExecOptions?
1408933
to
a9e1c2a
Compare
Thank you for the reviews! Apologies for waiting a day, my email client didn't show me that there were reviews, so I didn't notice until I manually checked. @andreimatei I think you're right. I've refactored it that way. Now Review status: 0 of 5 files reviewed at latest revision, 11 unresolved discussions, some commit checks pending. pkg/sql/executor.go, line 199 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. I agree with you that pkg/sql/executor.go, line 978 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
renamed to isAutomaticRetry, and added a comment in line 598 (where it first is created). pkg/sql/executor.go, line 1340 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. pkg/sql/executor.go, line 1350 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. You are correct, this is a much better way. pkg/sql/metric_test.go, line 41 at r1 (raw file): Previously, cuongdo (Cuong Do) wrote…
There is now! It's also renamed to pkg/sql/metric_test.go, line 115 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. I've earned some cleanup karma for today. We use subtests, and the test values are now defined in terms of increments so its easier to understand whats going on. PTAL. pkg/sql/metric_test.go, line 184 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. pkg/sql/metric_test.go, line 235 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
This was a mistake. Reverted. The semantics of pkg/ui/app/containers/nodeGraphs.tsx, line 104 at r1 (raw file): Previously, cuongdo (Cuong Do) wrote…
Done. pkg/internal/client/txn.go, line 482 at r1 (raw file): Previously, vivekmenezes wrote…
Followed Andrei's suggestion below instead. pkg/internal/client/txn.go, line 482 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Yes, that's a better idea. Thanks! Comments from Reviewable |
@andreimatei: what do you mean by dimensions? I'm unclear whether the latest changes capture your intent. Do you mean that the new DistSQL select count should be subordinate to the select count? If so, are you thinking about something like Review status: 0 of 5 files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. Comments from Reviewable |
Reviewed 1 of 10 files at r1, 9 of 9 files at r2. Comments from Reviewable |
Review status: 4 of 5 files reviewed at latest revision, 7 unresolved discussions, all commit checks successful. pkg/sql/executor.go, line 1007 at r3 (raw file):
nit: I would move calling pkg/sql/executor.go, line 1329 at r3 (raw file):
don't you need to pipe the retry argument to this level, and increment the metric conditionally? pkg/sql/metric_test.go, line 115 at r1 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
much better test now :) pkg/sql/metric_test.go, line 52 at r3 (raw file):
nit: I think this comment, or the comment on queryCounter struct, should say something about deltas. Comments from Reviewable |
Review status: 4 of 5 files reviewed at latest revision, 7 unresolved discussions, all commit checks successful. Comments from Reviewable |
Update the SQL metrics to track DistSQL queries separately from non-DistSQL queries in the Admin UI. Also fixed a TODO to stop double-counting transactions that are retried.
TFTRs! Review status: 2 of 5 files reviewed at latest revision, 7 unresolved discussions, some commit checks pending. pkg/sql/executor.go, line 1007 at r3 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Doing the latter, so keeping it here. pkg/sql/executor.go, line 1329 at r3 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Yes, you're right. Done. pkg/sql/metric_test.go, line 52 at r3 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. Comments from Reviewable |
Review status: 2 of 5 files reviewed at latest revision, 7 unresolved discussions, all commit checks successful. pkg/sql/executor.go, line 1329 at r3 (raw file): Previously, arjunravinarayan (Arjun Narayan) wrote…
I think there's an error here - the Comments from Reviewable |
Update the SQL metrics to track DistSQL queries separately from
non-DistSQL queries in the Admin UI. Also fixed a TODO to stop
double-counting transactions that are retried. This is the first PR
in a series to add all the features listed in #12143.
The Admin UI part is WIP, since we might want to list these under a new "SQL internals" page, since users may not know or care what DistSQL is. But the work in the backend is the same.
This change is