From: Oleg Ponomarev <[email protected]> Current implementation of cluster metrics has several disadvantages:
* non type safe * many positional arguments which is hard to read and easy to mistake * the description of each metrics component occur in several places in the file * necessity to add data type constructors for spread values * non type safe update and getValue functions in statistics.hs with default not-doing anyfing behavior for unknown types All the problems listed are fixed by replacing type unsafe implementation with the type safe one generated by template haskell. See the commit message fot the additional information. Oleg Ponomarev (1): Cluster metrics refactoring Makefile.am | 2 + src/Ganeti/HTools/Cluster/AllocatePrimitives.hs | 6 +- src/Ganeti/HTools/Cluster/Metrics.hs | 179 ++++---------- src/Ganeti/HTools/Cluster/MetricsComponents.hs | 308 ++++++++++++++++++++++++ src/Ganeti/HTools/Cluster/MetricsTH.hs | 187 ++++++++++++++ src/Ganeti/Utils/Statistics.hs | 180 +++++++------- test/hs/Test/Ganeti/Utils/Statistics.hs | 4 +- 7 files changed, 635 insertions(+), 231 deletions(-) create mode 100644 src/Ganeti/HTools/Cluster/MetricsComponents.hs create mode 100644 src/Ganeti/HTools/Cluster/MetricsTH.hs -- 1.9.1
