This is a Python program that collects GitLab activities using the GitLab API and generates Prometheus metrics using the prometheus_client library.
To use this program, you will need:
- Python 3.6 or later
- gitlab and prometheus_client Python packages
To install the required packages, run:
pip install -r requirements.txt
To use this program, you will need:
- A GitLab instance with an access token that has API access.
- The ID of the project that you want to monitor.
To run the program, execute the following command:
python gitlab_prometheus_monitor.py <gitlab_url> <access_token> <project_id>
For example:
python gitlab_prometheus_monitor.py https://gitlab.com my_access_token 123
This will start the Prometheus HTTP server on port 8000 and collect GitLab activities every 10 seconds.
To view the Prometheus metrics, open http://localhost:8000 in your web browser.
This program generates the following Prometheus metrics:
- merge_requests_count: Total number of merge requests in the specified time window.
- issue_count: Total number of issues in the specified time window.
This program is licensed under the MIT License. See the LICENSE file for details.