Configure descriptor sources using method chaining
The two descriptor sources
DescriptorParser are instantiated by
DescriptorSourceFactory, configured, and then executed. This requires state checks and leads to quite verbose application code. An exception to this is
DescriptorCollector which is state-less but which has a method with 5 parameters, which also does not produce very readable code.
We should consider switching to configuring descriptor sources using method chanining. Here's a code sample from a few months ago, written for another ticket.
iwakeh rightly commented on that other ticket: "configuration of a descriptor source by fluent-style (or method chaining) is fine, but metrics-lib currently has the DescriptorSourceFactory approach, which would need to be adapted. That is, I see two things: the ideas around the code of DescriptorSourceBuilder are ideas about a new way of configuration and not exception/error handling in metrics-lib, i.e. a different ticket (there is one for redesign of the interface hierarchy, I'll look for it). Second, the current configuration and descriptor source instanciation need to be considered together (in that other ticket)."
Not assigning to a milestone on purpose. This likely needs more thoughts before we can write code and make plans for releasing that.