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
sqlstats: generate PCT_RUNTIME sort when requested #123846
sqlstats: generate PCT_RUNTIME sort when requested #123846
Conversation
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.
Nice tests. I think in the future (as part of the redesign for this api) it'd be cool to do something like this where we can programmatically do this for all of the available sort options in the request.
Just the one comment with the sort and internal options.
&serverpb.CombinedStatementsStatsRequest{ | ||
FetchMode: &serverpb.CombinedStatementsStatsRequest_FetchMode{ | ||
StatsType: serverpb.CombinedStatementsStatsRequest_StmtStatsOnly, | ||
Sort: serverpb.StatsSortOptions(serverpb.StatsSortOptions_value[sortString]), |
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.
I think you're missing the limit here, and I don't think internal is a field on the request.
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.
Oh, I missed that internal was being passed below in the function - ignore that part.
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.
I just took out internal as a flag in the test cases, and added start/end
e563642
to
314bcf8
Compare
--ARGS-- | ||
[1970-01-01 00:00:01 +0000 UTC 1970-01-01 00:00:02 +0000 UTC 100] | ||
|
||
query sort=SERVICE_LAT limit=100 start=1 end=2 |
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.
nit: Could we have some test cases where limit is something other than 100 / when it's omitted? Just to verify it's putting the correct value.
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.
done.
Previously, when a request was made to the combined stats endpoint on CRDB with a `PCT_RUNTIME` sort, we'd default to a `svcLatency` sort instead because of a missing switch case. This change fills that gap and adds some datadriven tests to inspect the resulting `WHERE` clauses. Fixes: cockroachdb#123841 Epic: CRDB-37544 Release note (ui change): Viewing SQL Activity sorted by `% of Runtime` now correctly sorts entries by the runtime amount.
314bcf8
to
a8636af
Compare
bors r=xinhaoz |
Previously, when a request was made to the combined stats endpoint on CRDB with a
PCT_RUNTIME
sort, we'd default to asvcLatency
sort instead because of a missing switch case.This change fills that gap and adds some datadriven tests to inspect the resulting
WHERE
clauses.Fixes: #123841
Epic: CRDB-37544
Release note (ui change): Viewing SQL Activity sorted by
% of Runtime
now correctly sorts entries by the runtime amount.