Skip to content
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

[graal] Add configuration for Graal integration in ELK #320

Merged
merged 2 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ redis>=2.10.0, <=2.10.6
-e git+https://github.com/chaoss/grimoirelab-manuscripts/#egg=grimoirelab-manuscripts
-e git+https://github.com/chaoss/grimoirelab-kidash/#egg=grimoirelab-kidash
-e git+https://github.com/chaoss/grimoirelab-elk/#egg=grimoirelab-elk
-e git+https://github.com/chaoss/grimoirelab-graal/#egg=grimoirelab-graal
-e git+https://github.com/chaoss/grimoirelab-perceval/#egg=grimoirelab-perceval
-e git+https://github.com/chaoss/grimoirelab-perceval-puppet/#egg=grimoirelab-perceval-puppet
-e git+https://github.com/chaoss/grimoirelab-perceval-opnfv/#egg=grimoirelab-perceval-opnfv
Expand Down
15 changes: 14 additions & 1 deletion sirmordred/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,18 @@ def general_params(cls):
"default": False,
"type": bool,
"description": "Enable Mattermost menu"
},
"code-license": {
"optional": True,
"default": False,
"type": bool,
"description": "Enable Code License menu"
},
"code-complexity": {
"optional": True,
"default": False,
"type": bool,
"description": "Enable Code Complexity menu"
}
}
}
Expand Down Expand Up @@ -666,7 +678,8 @@ def get_study_sections(cls):
# a study name could include and extra ":<param>"
# to have several backend entries with different configs
studies = ("enrich_demography", "enrich_areas_of_code", "enrich_onion", "kafka_kip",
"enrich_pull_requests", "enrich_git_branches")
"enrich_pull_requests", "enrich_git_branches", "enrich_cocom_analysis",
"enrich_colic_analysis")

return studies

Expand Down
72 changes: 71 additions & 1 deletion sirmordred/task_panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,48 @@
]
}

MATTERMOST = "mattermost"
MATTERMOST_PANEL = "panels/json/mattermost.json"
MATTERMOST_IP = "panels/json/mattermost-index-pattern.json"

COCOM_NAME = 'Code Complexity'
COCOM_SOURCE = 'code-complexity'
COCOM_PANEL = "panels/json/cocom.json"
COCOM_IP = "panels/json/cocom-index-pattern.json"
COCOM_STUDY_IP = "panels/json/cocom_study-index-pattern.json"

COCOM_MENU = {
'name': COCOM_NAME,
'source': COCOM_SOURCE,
'icon': 'default.png',
'index-patterns': [
COCOM_IP,
COCOM_STUDY_IP
],
'menu': [
{'name': 'Overview', 'panel': COCOM_PANEL}
]
}

COLIC_NAME = 'Code License'
COLIC_SOURCE = 'code-license'
COLIC_PANEL = "panels/json/colic.json"
COLIC_IP = "panels/json/colic-index-pattern.json"
COLIC_STUDY_IP = "panels/json/colic_study-index-pattern.json"

COLIC_MENU = {
'name': COLIC_NAME,
'source': COLIC_SOURCE,
'icon': 'default.png',
'index-patterns': [
COLIC_IP,
COLIC_STUDY_IP
],
'menu': [
{'name': 'Overview', 'panel': COLIC_PANEL}
]
}


class TaskPanels(Task):
"""
Expand Down Expand Up @@ -225,6 +267,12 @@ def __init__(self, conf):
if self.conf['panels'][MATTERMOST]:
self.panels[MATTERMOST] = [MATTERMOST_PANEL, MATTERMOST_IP]

if self.conf['panels'][COCOM_SOURCE]:
self.panels[COCOM_SOURCE] = [COCOM_PANEL, COCOM_IP, COCOM_STUDY_IP]

if self.conf['panels'][COLIC_SOURCE]:
self.panels[COLIC_SOURCE] = [COLIC_PANEL, COLIC_IP, COLIC_STUDY_IP]

def is_backend_task(self):
return False

Expand Down Expand Up @@ -456,6 +504,12 @@ def __init__(self, conf):
if self.conf['panels'][KAFKA_SOURCE]:
self.panels_menu.append(KAFKA_MENU)

if self.conf['panels'][COCOM_SOURCE]:
self.panels_menu.append(COCOM_MENU)

if self.conf['panels'][COLIC_SOURCE]:
self.panels_menu.append(COLIC_MENU)

# Get the active data sources
self.data_sources = self.__get_active_data_sources()
if 'short_name' in self.conf['general']:
Expand All @@ -471,7 +525,7 @@ def __get_active_data_sources(self):
for entry in self.panels_menu:
ds = entry['source']
if ds in self.conf.keys() or ds in [COMMUNITY_SOURCE, KAFKA_SOURCE, GITLAB_ISSUES, GITLAB_MERGES,
MATTERMOST, GITHUB_REPOS]:
MATTERMOST, GITHUB_REPOS, COCOM_SOURCE, COLIC_SOURCE]:
active_ds.append(ds)
logger.debug("Active data sources for menu: %s", active_ds)

Expand Down Expand Up @@ -614,6 +668,16 @@ def __get_dash_menu(self, kibiter_major):
# Remove the kafka and community menus, they will be included at the end
kafka_menu = None
community_menu = None
cocom_menu = None
colic_menu = None

found_cocom = [pos for pos, menu in enumerate(ds_menu) if menu['name'] == COCOM_NAME]
if found_cocom:
cocom_menu = ds_menu.pop(found_cocom[0])

found_colic = [pos for pos, menu in enumerate(ds_menu) if menu['name'] == COLIC_NAME]
if found_colic:
colic_menu = ds_menu.pop(found_colic[0])

found_kafka = [pos for pos, menu in enumerate(ds_menu) if menu['name'] == KAFKA_NAME]
if found_kafka:
Expand All @@ -630,6 +694,12 @@ def __get_dash_menu(self, kibiter_major):
if kafka_menu:
omenu.append(kafka_menu)

if cocom_menu:
omenu.append(cocom_menu)

if colic_menu:
omenu.append(colic_menu)

if community_menu:
omenu.append(community_menu)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_init_studies(self):
enrich_onion_gerrit_params = config.conf['enrich_onion:gerrit'].keys()
enrich_demography_gerrit_params = config.conf['enrich_demography:gerrit'].keys()

self.assertEqual(len(config.conf.keys()), 22)
self.assertEqual(len(config.conf.keys()), 26)

self.assertIn('general', top_sections)
self.assertIn('projects', top_sections)
Expand Down
23 changes: 23 additions & 0 deletions tests/test_studies.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,29 @@ identities = true
enrichment = true
panels = true

[cocom]
raw_index = ??? # cocom_raw_graal_file
enriched_index = ??? # cocom_enrich_graal_file
category = ??? # code_complexity_lizard_file
studies = [enrich_cocom_analysis]
branches = ??? # master

[enrich_cocom_analysis]
out_index = ??? # default: cocom_enrich_graal_repo
interval_months = ??? # default: [3]

[colic]
raw_index = ??? # colic_raw_graal_file
enriched_index = ??? # colic_enrich_graal_file
category = ??? # code_license_scancode_cli
studies = [enrich_colic_analysis]
exec-path = ??? # executable path
branches = ??? # master

[enrich_colic_analysis]
out_index = ??? # default: colic_enrich_graal_repo
interval_months = ??? # default: [3]

[git]
raw_index = ???
enriched_index = ???
Expand Down