Currently, due to values using range logic (see RangedEntity class) as methods do and metrics using them as class methods do, we have some code duplications and not very clean places.
Main code duplication is checking that ranges are given correctly: see RangedEntity._check_fields(self) and Metric.__init_subclass__(cls).
I also don't like the requirement to create instances of children of Metric to use methods from RangedEntity. This is often used in analysis.stats.
One of the options is to design Metric so that specific metrics are its instances. Then we can use the same base class for Metric and Value. But I'd like to keep the same logic for Metric and AlertGen.
Currently, due to values using range logic (see
RangedEntityclass) as methods do and metrics using them as class methods do, we have some code duplications and not very clean places.Main code duplication is checking that ranges are given correctly: see
RangedEntity._check_fields(self)andMetric.__init_subclass__(cls).I also don't like the requirement to create instances of children of
Metricto use methods fromRangedEntity. This is often used inanalysis.stats.One of the options is to design
Metricso that specific metrics are its instances. Then we can use the same base class forMetricandValue. But I'd like to keep the same logic forMetricandAlertGen.