-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
145 additions
and
35 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ jobs: | |
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.10", "3.11"] | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
__pycache__/ | ||
.coverage |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: check-docstring-first | ||
- id: check-json | ||
- id: pretty-format-json | ||
args: [--autofix, --no-sort-keys] | ||
- id: check-added-large-files | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- repo: https://github.com/myint/docformatter | ||
rev: v1.5.1 | ||
hooks: | ||
- id: docformatter | ||
args: [--in-place] | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.3.1 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py38-plus] | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.0.0 | ||
hooks: | ||
- id: flake8 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,41 @@ | ||
# github-workflows-monitoring | ||
# GitHub Workflows Monitoring | ||
|
||
[![Tests](https://github.com/midokura/github-workflows-monitoring/actions/workflows/tests.yaml/badge.svg)](https://github.com/midokura/github-workflows-monitoring/actions/workflows/tests.yaml) | ||
|
||
## About | ||
|
||
Github Workflow Monitoring is a small Flask-based web server that connects to Github using websockets to monitor Github Actions workflows. It tracks each workflow's state (queued, in_progress, completed) and calculates the time spent in each state. The metrics are logged in logfmt format for easy consumption by Grafana. | ||
Github Workflows Monitoring is a small Python (Flask-based) application that processes [GitHub webhook calls] and logs them. | ||
It tracks each workflow's state (`queued`, `in_progress`, `completed`) and calculates the time spent in each state. | ||
|
||
This application can be very useful to gather information about Organization Runners: | ||
- How much time is spent before a job starts processing? | ||
- What repositories are triggering lots of jobs? | ||
|
||
The metrics are logged in `logfmt` format to simplify querying them (eg. with Grafana). | ||
|
||
[GitHub webhook calls]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/creating-webhooks | ||
|
||
## Setup | ||
|
||
Go to your **GitHub Organization** >> **Settings** >> **Webhooks** >> **Add new webhook**. | ||
|
||
Expose your application to Internet (ngrok, Load Balancer, etc), and **use endpoint** `/github-webhook`. | ||
|
||
![Example of Webhook configuration](media/github_setup.png) | ||
|
||
The **events** that are currently supported are: | ||
- Workflow jobs | ||
|
||
## Testing | ||
|
||
Into a virtual environment, install the requirements: | ||
|
||
pip install -r tests/requirements.txt | ||
|
||
```sh | ||
pip install -r tests/requirements.txt | ||
``` | ||
|
||
To run the tests: | ||
|
||
pytest --cov=src | ||
```sh | ||
pytest --cov=src | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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