Provide a modernized API for metrics-lib
In order to provide a more modern API in metrics-lib the interface hierarchy needs to be renewed/restructured/changed in backwards compatible ways.
A separate discussion led to the following results:
-
The new interfaces will be placed in new packages, which allows for keeping good names and improving other w/o disturbing the existing classes. Suggested packages:
- org.torproject.metrics.descriptor
- org.torproject.metrics.descriptor.impl
- org.torproject.metrics.index
- org.torproject.metrics.internal
-
Besides improving the general structure consider different return types for all time related values and use java.util.Optional for all optional values and other java 8 features (as mentioned in summary ticket #23752 (moved)).
Possible next steps:
- Use a small, i.e., limited to few classes/interfaces, prototype example for finding the right approach to make these two interface hierarchies live beside each other and minimize additional implementation.
- Use the working prototype approach to try new naming rules for methods.
- Extend the found solution to the entire public API.
- Choose first code base to use the new interface hierarchy.
- Possibly improve new interface hierarchy.
- Use new interfaces in all Metrics products.
The other ticket related to an improved metrics-lib API is obsolete with this new approach; for reference and as improvement-idea resource: #19640 (moved). There is a pending new interfaces, which should be only implemented with the new hierarchy (if demand permits): #17861 (moved). The work-in-progress interfaces (and implementations) for webstats could be moved into the new hierarchy already, but could also be easily moved later.