Skip to content

Clean code for range logic between values and metrics #3

Description

@sandsbit

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

codeClean code and architecture changes

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions