-
Notifications
You must be signed in to change notification settings - Fork 9
Add Github issues and PRs scanner #8
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
base: main
Are you sure you want to change the base?
Changes from all commits
0bc940d
5fdca3b
6b2228d
75346a9
454233e
b0359a0
0fb16e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
version: '3' | ||
|
||
services: | ||
# Elasticsearch node required as a database for Apache Kibble | ||
elasticsearch: | ||
image: elasticsearch:7.13.1 | ||
ports: | ||
- 9200:9200 | ||
- 9300:9300 | ||
environment: | ||
node.name: es01 | ||
discovery.seed_hosts: es02 | ||
cluster.initial_master_nodes: es01 | ||
cluster.name: kibble | ||
ES_JAVA_OPTS: -Xms256m -Xmx256m | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
volumes: | ||
- "kibble-es-data:/usr/share/elasticsearch/data" | ||
|
||
# Kibana to view and manage Elasticsearch | ||
kibana: | ||
image: kibana:7.13.1 | ||
ports: | ||
- 5601:5601 | ||
depends_on: | ||
- elasticsearch | ||
environment: | ||
ELASTICSEARCH_URL: http://elasticsearch:9200 | ||
ELASTICSEARCH_HOSTS: http://elasticsearch:9200 | ||
|
||
volumes: | ||
# named volumes can be managed easier using docker-compose | ||
kibble-es-data: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
.. Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
.. http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
.. Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
|
||
Apache Kibble Overview | ||
====================== | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sharanf @Humbedooh @kaxil @michalslowikowski00 I added some docs/notes about current status and how things are. Let me know what do you think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Tomek! This is good work. I have added some minor text changes. |
||
|
||
Kibble configuration | ||
-------------------- | ||
|
||
Currently Apache Kibble is configured using `kibble.yaml` configuration file. | ||
|
||
Database configuration | ||
...................... | ||
|
||
.. code-block:: | ||
|
||
elasticsearch: | ||
hosts: | ||
- http://localhost:9200 | ||
|
||
Data sources configuration | ||
.......................... | ||
|
||
Multiple data sources can be configured. Each data source is defined by a python class. Additionally to that users | ||
have to pass ``name`` and ``config`` which is a configuration specific for a given data source. | ||
|
||
.. code-block:: | ||
|
||
data_sources: | ||
- name: name | ||
class: path.to.a.Class | ||
config: | ||
# Data source specific configuration | ||
|
||
Data source | ||
----------- | ||
|
||
Data source represents an external source of information (for example Github, JIRA, mailing list etc). Each data source | ||
is a python package. In this way users can easily build their own data sources and use them with Kibble. | ||
|
||
Data source package has to have the following structure: | ||
|
||
.. code-block:: | ||
|
||
data_source_name/ | ||
| __init__.py | ||
| ... | ||
| data_types | ||
| | __init__.py | ||
| | type1.py | ||
| | type2.py | ||
| | ... | ||
|
||
The ``data_source_name.__init__`` should include the class defining the data source but the class can be placed in another | ||
file in top leve directory of the package. | ||
|
||
Data types | ||
.......... | ||
|
||
Data type represents a single type of data within a data source. For example if Github is a data source then issues and | ||
comments will be two different data types. A data type is a class that has to implement ``fetch_data`` method that is | ||
used to fetch and persist data. | ||
|
||
Data types are automatically determined using data source class path. | ||
|
||
Each data type is an index in Kibble elasticsearch instance. The data should be stored "as is" so users can leverage existing | ||
documentation. | ||
|
||
Next to persisting data, a data type should also define metrics that can be calculate on retrieved data. | ||
|
||
Configuring a data source | ||
......................... | ||
|
||
As described previously data sources can be configured in ``kibble.yaml`` config file. For example: | ||
|
||
.. code-block:: | ||
|
||
data_sources: | ||
- name: kibble_github | ||
class: kibble.data_sources.github.GithubDataSource | ||
config: | ||
repo_owner: apache | ||
repo_name: kibble | ||
enabled_data_types: | ||
- issues | ||
- discussions | ||
|
||
- name: pulsar_github | ||
class: kibble.data_sources.github.GithubDataSource | ||
config: | ||
repo_owner: apache | ||
repo_name: pulsar | ||
enabled_data_types: | ||
- issues | ||
- comments | ||
|
||
- name: pulsar_dev_list | ||
class: kibble.data_sources.pony.PonyDataSource | ||
config: | ||
list_name: [email protected] | ||
enabled_data_types: | ||
- threads | ||
|
||
In the above example we can see that: | ||
|
||
* We configured two different data sources based on ``GithubDataSource``: apache/pulsar and apache/kibble Github repositories. | ||
For both sources we fetch different information. For Kibble we fetch issues and discussions data while for Apache | ||
Pulsar we fetch issues and comments data. | ||
* There's also a third data source using ``PonyDataSource`` configured for Apache Pulsar dev list. | ||
|
||
Thanks to this design users will gain more granularity to configure the data they want to fetch. This also creates a big | ||
opportunity for configuring different authorization options for each data source in future. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.. Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
.. http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
.. Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.. Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
.. http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
.. Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
|
||
Installation steps | ||
================== | ||
|
||
To install Apache Kibble run: | ||
|
||
.. code-block:: | ||
|
||
pip install -e ".[devel]" | ||
|
||
You will also need a Elasticsearch instance up and running. You can setup one using docker-compose | ||
|
||
.. code-block:: | ||
|
||
docker-compose -f docker-compose.dev.yaml up | ||
|
||
Once ES is running you can scan configured data sources: | ||
|
||
.. code-block:: | ||
kibble scanners run -s github_kibble |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from pathlib import Path | ||
from typing import Dict | ||
|
||
import yaml | ||
|
||
KIBBLE_YAML = "kibble.yaml" | ||
|
||
|
||
def parse_kibble_yaml() -> Dict: | ||
"""Reads kibble.yaml config file""" | ||
config_path = Path(__file__).parent.parent.joinpath(KIBBLE_YAML) | ||
with open(config_path, "r") as stream: | ||
config = yaml.safe_load(stream) | ||
return config | ||
|
||
|
||
kconfig = parse_kibble_yaml() | ||
|
||
if __name__ == "__main__": | ||
parse_kibble_yaml() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. |
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.