cockroachdb / cockroachdb/cockroach
server: redesign CombinedStatementStats and StatementDetails
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Unwieldy code in the [CombinedStatementStats](https://github.com/cockroachdb/cockroach/blob/master/pkg/server/combined_statement_stats.go) and [StatementDetails](https://github.com/cockroachdb/cockroach/blob/master/pkg/server/statement_details.go) api handlers creates bugs and makes testing these apis difficult.
We should redesign these apis by breaking them down to more easily testable components. There is currently a lot of entangled logic that deals with building various queries based on the request and the state of the activity, persisted and in-memory tables for statement and transaction statistics. We could create response builders that build these queries independently given the required state to more easily unit test and validate each query. The refactor should ideally include data driven testing that would validate the response and aggregation logic of every query that could be executed by the request handlers.
Related: https://github.com/cockroachdb/cockroach/issues/108540
Jira issue: CRDB-36938
Epic CRDB-39643
Contributor guide
Assessment
This issue has not been assessed yet.