Bring the S03-B database metrics table up to the shipped families

Split from #1606 (closed) (gap 6, the families that exist today). Parent epic: &24088.

Operator ruling 2026-10-25 (Q7): each child of #1606 (closed) amends S03-B in its own MR, and this issue lands first to catch up the existing rows. The children that add families (#1719 (closed), #1722, #1723 (closed), #1725 (closed)) then add their rows to a table that is already correct.

Problem

The S03-B ### Database table lists four families. The code and docs/dev/observability.md publish eleven. The spec is the source of truth (guardrail 1), and it is behind the code.

Evidence

Research base: origin/main at e2c420456, 2026-10-25.

  • docs/specs/S03-b-metrics.md:348-353 lists database_query_duration_seconds, database_queries_total, database_connection_pool_size and database_connection_pool_max_size.
  • docs/dev/observability.md:36-48 also documents database_query_errors_total, database_query_cancellations_total{cancellation_reason}, …pool_acquires_total, …pool_acquire_duration_seconds_total, …pool_empty_acquires_total, …pool_canceled_acquires_total, …pool_opens_total, …pool_max_lifetime_destroys_total and …pool_max_idle_destroys_total.
  • The code is at internal/metrics/database.go:51-66 (errors and cancellations) and :176-248 (pool collector).
  • docs/specs/S03-b-metrics.md:535 still gives the name budget as "up to ~200". The code has 700 (internal/metrics/cardinality.go:49) and about 616 declared names. #908 (closed) tracks the policy question. This issue only corrects the number, and only if #908 (closed) has not done it first.
  • The InstrumentQuery prose (:355-389) describes only the two-vector closure. InstrumentQueryErr, InitQuery and the startup seeding are not in it.

Fix direction

  • Add the seven missing rows to the S03-B table, with the labels and closed sets that observability.md states. Link to observability.md for how to read each one, so the spec does not copy it.
  • Describe InstrumentQueryErr(name) func(*error) and InitQuery(name) in the instrumenter prose.
  • Set the name budget row to match the code, or leave a pointer to #908 (closed).

Acceptance criteria

  • Every gitlab_artifact_registry_database_* family that internal/metrics registers on origin/main has a row in the S03-B ### Database table, with the same labels.
  • The instrumenter prose names InstrumentQueryErr and InitQuery.
  • The name budget in the expected-distinct-values table agrees with internal/metrics/cardinality.go, or points to #908 (closed).
  • The spec stays Status: Approved.

Size and fit

About 30-80 lines of docs. This fits one smurfit unit, and it can land now.

Dependencies

None. Land it first.

Edited by Pawel Rozlach