grimoirelab-elk
grimoirelab-elk copied to clipboard
[utils] Use entry points to support plugin mechanism
This PR aims to support plugin mechanism for ELK. Related with #880 .
This code uses pkg_resources.iter_entry_points() to discover the registered entry point grimoire_elk and then load the connectors of external backends :
ENTRY_POINT_NAME = "grimoire_elk"
def get_connectors():
# The default connectors
connectors = {}
for entry_point in pkg_resources.iter_entry_points(ENTRY_POINT_NAME):
connectors.update(entry_point.load()())
return connectors
Maybe we need pick up anothe suitable definition for ENTRY_POINT_NAME instead of grimoire_elk, I guess.
I will write some documentation for external packages about how to register themselves if necessary.
Please @valeriocos @sduenas @WillemJiang help look into this and any feedback or suggestions are appreciated.
Signed-off-by: LinHaiming [email protected]
Pull Request Test Coverage Report for Build 2219
- 0 of 0 changed or added relevant lines in 0 files are covered.
- 49 unchanged lines in 2 files lost coverage.
- Overall coverage decreased (-0.04%) to 81.844%
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| /home/travis/build/chaoss/grimoirelab-elk/grimoire_elk/enriched/github.py | 2 | 75.06% |
| /home/travis/build/chaoss/grimoirelab-elk/grimoire_elk/utils.py | 47 | 65.54% |
| <!-- | Total: | 49 |
| Totals | |
|---|---|
| Change from base Build 2216: | -0.04% |
| Covered Lines: | 8150 |
| Relevant Lines: | 9958 |
💛 - Coveralls
Hi @valeriocos, @sduenas and @vchrombie,
Could you help review the code? It has been discussed in #880, as the plugin proposal.
As we discussed in https://github.com/chaoss/grimoirelab/issues/439, I have created a seperated repo grimoirelab-gitee to include grimoirelab-gitee solution, that also depend on this plugin solution.
Thanks.
This was implemented in https://github.com/chaoss/grimoirelab-elk/pull/1062