Bobtfish refactor for multiple backend support #44

merged 11 commits into from Feb 28, 2014

2 participants


A cleaned-up version of #41 with some nitpick fixes from me.
Closes #41

bobtfish and others added some commits Feb 8, 2014
@bobtfish bobtfish Move the reporter construction into a factory method.
The factory method lives on the reporter class, as it's going to become
the method with the logic for loading different reporter backends
(for support of things such as etcd).

This is the first step refactoring towards that. There aren't
any current tests, but the method extraction is trivial enough
and I'll build some tests out as I contine to develop the ability
to have multiple reporters.
@bobtfish bobtfish Add a skeleton zookeeper reporter.
We're not actually using it in any way yet, but this adds the dynamic class loading
so that we can plug other backends in more easily.

The zookeeper reporter inherits from the main reporter where all the code still lives,
so that moving the bulk of the code can be a latter step in refactoring
@bobtfish bobtfish Actually start returning the new class 870bd97
@bobtfish bobtfish Move all zookeeper specific initialization to that reporter.
We're now at the point where all the construction logic is inverted to factories at the variously
correct levels.

Next steps are to start moving zookeeper specific code out of the base classes
@bobtfish bobtfish Finish adjusting the class hierarchy.
The factory class is now seperate from the base class, which isn't a big deal, but I think is
more elegant (as then the subclasses don't inherit the factory method).

Next up, moving all the code into the child class
@bobtfish bobtfish Actually move all the code into zookeeper backend.
Leave stubs in the base class which become abstract methods
@bobtfish bobtfish Remove backend specific factory method in favour of initialize.
Now that all the code is turned round and in the right place, we can elminiate the complexity
of this factory method which is only really doing arg munging.
@bobtfish bobtfish Fix up bug of still requiring zk_hosts for all backends.
Just remove the checks from the service_watcher, as the reporter already
does the appropriate data validation. Also cleanup the initalize method
in the zookeeper reporter, as it was an over-complex mash of the
initialization code moved in there from the factory method whilst
@bobtfish bobtfish Not actually using pry 82b4cdc
@igor47 igor47 keep base reporter in it's own file
removes unused imports from the reporter factory file
@igor47 igor47 documentation: reporter type and the role of `host`
* documents the new `reporter_type` parameter
* makes it clear that there might be other types of reporters beside zookeeper
* clarifies the roles of the `instance_id` and `host` fields
@igor47 igor47 merged commit fadcb8c into master Feb 28, 2014
@igor47 igor47 deleted the bobtfish-refactor_for_multiple_backend_support branch Feb 28, 2014
@jolynch jolynch referenced this pull request Sep 14, 2015

Reporter "methods" #21

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