We currently have the abstract class Metric and subclasses Availability and Gauge. The subclasses serve no purpose other than being type discriminators. They provide no additional, type-specific functional. Instead they cause some bloat in the code base.
I propose the following changes with this ticket.
- Do away with the Gauge and Availability subclasses and make Metric concrete.
- Turn Metric into an interface and rename the current class to MetricImpl
- Rename MetricData to DataPoint and make it an interface
For DataPoint we would have something like,
and for Metric something like,
This provides a much cleaner separation between API and implementation than we currently have, which can make it a bit difficult to understand what exactly is the public API.
Lastly, it should be noted that these changes should not involve any changes to the REST API. They will however, require changes to handler methods to use the new interfaces and classes.