-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module arch improvement #120
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…arch-improvement
@vgratian Can you incorporate the changes we discussed in our last meeting?
I think your PR is the next natural step for what was started in #100. |
cgrinds
reviewed
Jun 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left general comment above
Closing this for now until we have time to pickup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First, to safe us the language-confusion, about the terms used below:
This is a follow-up on the changes applied by #106 for issue #100. This changes have greatly simplified Harvest and removed some unnecessary complications due to our use of Go's plugin library (not to be confused with Harvest's plugins). On the other hand, there are a number of drawbacks:
cmd/poller/poller.go
: if a user or developer wants to add a new collector, they have to edit that file (and re-edit after each update of Harvest).cmd/poller/poller.go
cmd/plugin/plugin.go
. This module originally defined the plugin type and interfaces and implemented its base type ("AbstractPlugin"). Combining two unrelated concepts, will lead to unnecessary confusion in the future.How I propose to improve:
modules.txt
. Users can safely edit this file to add new modules, including third-party modules.make modules
will generate the filecmd/poller/modules/modules.go
which will import all of these modules. This command will also optionally install these modules if they are not part of Harvest (e.g. third-party collectors).cmd/poller/registrar/registrar.go
. Each module will explicitly register either as a collector, plugin or exporter using the methodsregistrar.RegisterCollector()
,registrar.RegisterExporter()
,registrar.RegisterPlugin()
.HarvestModule
, for the same reason.I think these improvements will give Harvest a lot of flexibility. Adding new collectors, exporters or plugins does not require to touch the core code-base of Harvest. We only need to edit
harvest.yml
andmodules.txt
. I have even tried using this "third-party" collector this way.Only issue left to address: