Skip to content

obs/ash: expose workload_type in ASH virtual tables#165866

Merged
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
alyshanjahani-crl:ash-workload-type
Mar 17, 2026
Merged

obs/ash: expose workload_type in ASH virtual tables#165866
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
alyshanjahani-crl:ash-workload-type

Conversation

@alyshanjahani-crl
Copy link
Collaborator

@alyshanjahani-crl alyshanjahani-crl commented Mar 17, 2026

Expose workload_type in the ASH tables and views

Part of: https://cockroachlabs.atlassian.net/browse/CRDB-60684
Release note: None

@alyshanjahani-crl alyshanjahani-crl requested review from a team as code owners March 17, 2026 00:44
@alyshanjahani-crl alyshanjahani-crl requested review from jasonlmfong and removed request for a team March 17, 2026 00:44
@trunk-io
Copy link
Contributor

trunk-io bot commented Mar 17, 2026

😎 Merged successfully - details.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

The ASH sampler already tracks WorkloadType internally via the
WorkloadInfo struct, but this field was not surfaced in the ASHSample
struct, the protobuf message, or the virtual tables. Users had no way
to distinguish whether a sampled workload was a statement, job, system
task, or unknown type.

Thread workload_type through all layers: add the field to the Go
ASHSample struct, populate it during sampling from
WorkloadInfo.WorkloadType.String(), add a proto field (field 9), map
it in the status server RPC conversion, and add the column to both
crdb_internal.node_active_session_history and
crdb_internal.cluster_active_session_history as well as their
information_schema views.

Empty strings from old nodes during rolling upgrades are guarded to
"UNKNOWN" at the virtual table layer. No cluster version gate is
needed since this is an additive proto field and virtual table schema
change with no persisted state.

Release note (sql change): Added a `workload_type` column to the
`crdb_internal.node_active_session_history` and
`crdb_internal.cluster_active_session_history` virtual tables, as
well as the corresponding `information_schema` views. The column
exposes the type of workload being sampled, with possible values
"STATEMENT", "JOB", "SYSTEM", or "UNKNOWN".

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@alyshanjahani-crl
Copy link
Collaborator Author

/trunk merge

@trunk-io trunk-io bot merged commit e7e6b14 into cockroachdb:master Mar 17, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants