ccl: support displaying database & table counts for serverless clusters #71573
Labels
A-sql-observability
Related to observability of the SQL layer
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
In CockroachCloud console, designs surface the number of databases and tables in a serverless cluster.
In implementing this (small!) feature, it is important that we
In internal discussions, there was general agreement that SQL pods, when running, could publish these numbers as metrics in Prometheus to achieve these goals. (There was some discussion whether to use counters (create-drop) or gauges. We converged on gauges as being easier to keep true.) Alternatively, maintaining a cache in the cloud control plane could have worked but would have faced the usual invalidation issues.
When to update the metrics? We considered simply polling for changes, publishing new values every 1-5 minutes. (It is acceptable for the values to drift, so long as they are eventually true.) But we rejected polling because, though the implementation would be simple and easy to reason about, it seemed an inelegant use of resources, given that schema changes are relatively rare. So we decided to instead hook into the various schema change events that would create or drop databases or tables.
#72938 takes this approach, truing up database and table count gauges on the relevant schema changes, but it is not without its problems:
crdb_internal.databases
and.tables
during a schema change -- and, frankly, what that cost is.Where to go from here?
Epic: CC-5060
Jira issue: CRDB-10657
The text was updated successfully, but these errors were encountered: