We have nested structure called MemoryUsageTracker inside DocumentSourceGroup, which tracks memory related statistics.
Ticket 48380 introduced GroupStats in the file src/mongo/db/exec/plan_stats.h
While working on this CR, I moved 2 fields from MemoryUsageTracker, namely, memoryUsageBytes and usedDisk to GroupStats.
I did not moved all the fields of MemoryUsageTracker to GroupStats taking into consideration that exposing all fields might not be required.
But, having 2 separate structure to track the stats of DocumentSourceGroup is also not legible.
As part of this ticket, we should attempt to revisit MemoryUsageTracker's stats and see if we can move more field to the GroupStats. And if possible, get rid of MemoryUsageTracker all together.
Commit details for your reference: https://github.com/mongodb/mongo/commit/62a3ca9041393dca40273ff935677c686cfa7fbb