-
Type:
Improvement
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
QO 2023-01-23
A CollectionStatistics is not concerned about the source of histograms. E.g., CollectionStatisticsImpl should get its data from from the stats cache that is accessed when CollectionStatisticsImpl::getHistogram is called. While CollectionStatisticsMock used it tests should provide a more flexible interface to return custom histograms.
That said, it seem that CollectionStatistics::addHistogram should not be part of the CollectionStatistics interface and we may consider removing it.
To facilitate testing the addHistogram method can be kept in the CollectionStatisticsMock class.
Another idea proposed by Misha would be changing addHistogram to a private _addHistogram and adding addHistogramForTest to clarify that this API is only for testing.
In addition, currently when addHistogram is called providing a path for which a histogram already exists, we silently replace the old entry. If this behaviour is fine, we may consider changing the name to addOrReplaceHistogram, or otherwise raise an error.