Skip to content

Conversation

@alyshanjahani-crl
Copy link
Collaborator

This commit starts recording the newly added kvCPUTime field from topLevelQueryStats and exposes it in the UI.

Fixes: https://cockroachlabs.atlassian.net/browse/CRDB-57265 Release note (ui change): KV CPU Time is now recorded to statement_statistics and transaction_statistics and is displayed in the SQL Activity page.

@alyshanjahani-crl alyshanjahani-crl requested a review from a team as a code owner November 26, 2025 20:42
@alyshanjahani-crl alyshanjahani-crl requested review from jasonlmfong and removed request for a team November 26, 2025 20:42
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@alyshanjahani-crl
Copy link
Collaborator Author

Column on Statements table, Column on Transactions table, tool tip, listing kvCPUTime on panel in stmt fingerprint overview

Screenshot 2025-11-26 at 15 28 51 Screenshot 2025-11-26 at 15 29 21 Screenshot 2025-11-26 at 15 29 32 Screenshot 2025-11-26 at 15 29 50

@alyshanjahani-crl alyshanjahani-crl force-pushed the sql-stats-add-kvcpu branch 2 times, most recently from 77852ac to ab654a6 Compare November 26, 2025 20:50
Copy link
Contributor

@kyle-a-wong kyle-a-wong left a comment

Choose a reason for hiding this comment

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

Looks good, juste have a small request about the new field name

@kyle-a-wong reviewed 16 of 19 files at r1, 1 of 1 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jasonlmfong)


pkg/sql/appstatspb/app_stats.proto line 148 at r1 (raw file):

  // representative of the "synchronous" portion of work performed by KV
  // (ex/ not replication related work).
  optional NumericStat kv_cpu_time = 38 [(gogoproto.nullable) = false, (gogoproto.customname) = "KVCPUTime"];

Can we name this kv_cpu_time_nanos to match the naming convention of cpu_time_nanos in ExecStats?


pkg/sql/appstatspb/app_stats.proto line 200 at r1 (raw file):

  // representative of the "synchronous" portion of work performed by KV
  // (ex/ not replication related work).
  optional NumericStat kv_cpu_time = 12 [(gogoproto.nullable) = false, (gogoproto.customname) = "KVCPUTime"];

Same here


pkg/sql/sqlstats/ssprovider.go line 88 at r1 (raw file):

	RowsRead                 int64
	RowsWritten              int64
	KVCPUTime                int64

Same comment here, can we name it `KVCPUTimeNanos

Copy link
Member

@jasonlmfong jasonlmfong left a comment

Choose a reason for hiding this comment

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

nit: on top of what Kyle said, would it also make sense to replace cpu in go/ts to SQLcpu to contrast the KVcpu even more?
otherwise :lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @alyshanjahani-crl and @kyle-a-wong)


pkg/sql/appstatspb/app_stats.proto line 148 at r1 (raw file):

Previously, kyle-a-wong (Kyle Wong) wrote…

Can we name this kv_cpu_time_nanos to match the naming convention of cpu_time_nanos in ExecStats?

agree with this one

This commit starts recording the newly added kvCPUTime field from
topLevelQueryStats and exposes it in the UI.

Fixes: https://cockroachlabs.atlassian.net/browse/CRDB-57265
Release note (ui change): KV CPU Time is now recorded to statement_statistics
and transaction_statistics and is displayed in the SQL Activity page.
@alyshanjahani-crl alyshanjahani-crl requested a review from a team as a code owner November 27, 2025 21:08
@alyshanjahani-crl alyshanjahani-crl requested review from ZhouXing19 and kyle-a-wong and removed request for a team November 27, 2025 21:08
@alyshanjahani-crl
Copy link
Collaborator Author

Renamed to KVCPUTimeNanos

For future reference though, can we not use "requested changes" for nit's / trivial changes / renames.
I can do a rename and then merge, but w/ "requested changes" it blocks merging.

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.

4 participants