Description:
Added 5 new fields to serverStatus.transactions:
totalPrepared (type: long, default: 0) - the total number of prepared transactions since the last server startup.
totalPreparedThenCommitted (type: long, default: 0) - the total number of prepared transaction commits.
totalPreparedThenAborted (type: long, default: 0) - the total number of prepared transaction aborts.
currentPrepared (type: long, default: 0) - the current number of transactions in the prepared state.
oldestActiveOplogEntryOpTime (type: timestamp, default: Timestamp(0, 0)) - the optime of the oldest oplog entry for any active transaction.
Engineering Ticket Description:
Similar to the transactions diagnostics project, we want to maintain certain metrics in the serverStatus section. The TransactionsSSS::generateSection method returns a BSON object that goes into the transactions section of the serverStatus output.
This ticket can be split into multiple commits if needed. We will want to output:
- the total number of prepared transactions
- the total number of committed prepared transactions
- the total number of aborted prepared transactions
We will need to add these counters to ServerTransactionMetrics and the transactions_stats.idl class, so that we can serialize these counters to the serverStatus output object in the TransactionsSSS::generateSection method.
We will also update the TransactionMetricsObserver to increment/decrement the stats when appropriate.