feat(metrics): add the transaction metric families (#1719 stack: 1/3)

This part adds the two database transaction metric families to internal/metrics: database_transaction_duration_seconds{transaction} and database_transaction_outcomes_total{transaction, transaction_outcome}. It adds InstrumentTx, InitTransaction, the CommitFailedError commit-site marker, the outcome classification, the cardinality budget and closed set for the two new labels, and the metricstest.TxOutcomeCount test reader. RegisterDatabaseMetrics registers the two vectors, so the families are on /-/metrics from boot. Nothing calls InstrumentTx yet, so this part changes no transaction's behavior. It stands on its own because it imports nothing from internal/datastore, and its unit tests cover the instrumentation, the outcome arms and the audit.

Stack

This merge request is part 1 of 3 of one reviewed change (vespian_gl/issue-1719-publish-transaction-duration-and-outcome), split into a stack so each part is reviewable on its own. Merge the parts in this order, bottom first:

  1. !3545 (merged) feat(metrics): add the transaction metric families (#1719 (closed) stack: 1/3) (this merge request)
  2. !3546 (merged) feat(datastore): name every transaction for metrics (#1719 (closed) stack: 2/3)
  3. !3532 (merged) feat(lifecycle): meter the tombstone transaction (#1719 (closed) stack: 3/3)

It is the bottom of the stack and merges first. !3546 (merged), the part above it, targets this one and merges after it.

Related to #1719 (closed)

This is a bot message 🤖 — /smurfit

Edited by Pawel Rozlach

Merge request reports

Loading
Loading