cockroachdb / cockroachdb/cockroach
sql: statement statistics merge at transaction end does not respect individual statement statistic application names
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
When a transaction ends, the `connExecutor`'s `statsCollector` merges in-memory statement statistics into a single `ApplicationStats` container. This method ([MergeApplicationStatementStats](https://github.com/cockroachdb/cockroach/blob/master/pkg/sql/sqlstats/ssmemstorage/ss_mem_storage.go#L631)) essentially throws away the application name for individual statement statistics, in favor of the application name stored in the `ApplicationStats` container.
This results in some statement-statistics-reporting surfaces (e.g., the diagnostics reporter) grouping all statement statistics in a transaction by a single application name (the last application name set in the transaction).
Follow up to #107593
Jira issue: CRDB-32148
Contributor guide
Assessment
This issue has not been assessed yet.