WiredTiger has some statistics that are maintained for each session. They are tightly coupled to the storage section of the slow operation statistics in the server. This prevents adding session statistics in WiredTiger without addressing that statistic in the server. Here is an example from
WT-8848: WT-8848 wants to add a new statistic, bytes dirtied by a transaction. But doing so trips the invariant in the server as there is a hard coded map between server's expectation and the sessions statistics.
Also, fetching the statistics causes all the stats to be reset to 0. This is okay when there is one operation per transaction. In the case of MongoDB multi-doc transactions, there could be several WiredTiger operations at the end of which these stats get reset to 0. The server accumulates these stats for the purpose of logging. If we were to decouple the slow operation stats known to the server from the WiredTiger's session statistics, we will have to make sure there is a workaround for not mistakenly resetting all the statistics to zero. So, in this case, the dirtied bytes by the transaction should not be reset to zero until the end of the multi-doc transaction.