Skip to content

Added logic to automatically infer list of metrics and labels for each metric from Prometheus #108

Added logic to automatically infer list of metrics and labels for each metric from Prometheus

Added logic to automatically infer list of metrics and labels for each metric from Prometheus #108

Workflow file for this run

name: Python Projects CI
on:
push:
branches: [ main ]
paths:
- 'asap-summary-ingest/**'
- 'asap-tools/queriers/prometheus-client/**'
- 'asap-tools/**'
- 'asap-tools/data-sources/prometheus-exporters/**'
- 'asap-tools/execution-utilities/**'
- 'asap-common/dependencies/py/**'
- '.github/workflows/python.yml'
pull_request:
branches: [ main ]
paths:
- 'asap-summary-ingest/**'
- 'asap-tools/queriers/prometheus-client/**'
- 'asap-tools/**'
- 'asap-tools/data-sources/prometheus-exporters/**'
- 'asap-tools/execution-utilities/**'
- 'asap-common/dependencies/py/**'
- '.github/workflows/python.yml'
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
summary_ingest: ${{ steps.filter.outputs.summary_ingest }}
prometheus_client: ${{ steps.filter.outputs.prometheus_client }}
utilities: ${{ steps.filter.outputs.utilities }}
prometheus_exporters: ${{ steps.filter.outputs.prometheus_exporters }}
execution_utilities: ${{ steps.filter.outputs.execution_utilities }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
summary_ingest:
- 'asap-summary-ingest/**'
- 'asap-common/dependencies/py/**'
prometheus_client:
- 'asap-tools/queriers/prometheus-client/**'
- 'asap-common/dependencies/py/**'
utilities:
- 'asap-tools/**'
- 'asap-common/dependencies/py/**'
prometheus_exporters:
- 'asap-tools/data-sources/prometheus-exporters/**'
- 'asap-common/dependencies/py/**'
execution_utilities:
- 'asap-tools/execution-utilities/**'
- 'asap-common/dependencies/py/**'
test-summary-ingest:
needs: detect-changes
if: needs.detect-changes.outputs.summary_ingest == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0
if [ -f asap-summary-ingest/requirements.txt ]; then pip install -r asap-summary-ingest/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-summary-ingest
run: black --check --diff .
- name: Lint with flake8
working-directory: asap-summary-ingest
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../.flake8 --count --exit-zero --max-complexity=10 --statistics
test-prometheus-client:
needs: detect-changes
if: needs.detect-changes.outputs.prometheus_client == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0 mypy types-requests types-PyYAML typing-extensions numpy prometheus-client urllib3
if [ -f asap-tools/queriers/prometheus-client/requirements.txt ]; then pip install -r asap-tools/queriers/prometheus-client/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-tools/queriers/prometheus-client
run: black --check --diff .
- name: Lint with flake8
working-directory: asap-tools/queriers/prometheus-client
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../../../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../../../.flake8 --count --exit-zero --max-complexity=10 --statistics
- name: Type check with mypy
working-directory: asap-tools/queriers/prometheus-client
run: mypy .
test-utilities:
needs: detect-changes
if: needs.detect-changes.outputs.utilities == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0
if [ -f asap-tools/requirements.txt ]; then pip install -r asap-tools/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-tools
run: black --check --diff .
- name: Lint with flake8
working-directory: asap-tools
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../.flake8 --count --exit-zero --max-complexity=10 --statistics
test-prometheus-exporters:
needs: detect-changes
if: needs.detect-changes.outputs.prometheus_exporters == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0 mypy isort
if [ -f asap-tools/data-sources/prometheus-exporters/requirements.txt ]; then pip install -r asap-tools/data-sources/prometheus-exporters/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-tools/data-sources/prometheus-exporters
run: black --check --diff .
- name: Check import sorting with isort
working-directory: asap-tools/data-sources/prometheus-exporters
run: isort --check-only --diff --settings-file .isort.cfg .
- name: Lint with flake8
working-directory: asap-tools/data-sources/prometheus-exporters
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../../../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../../../.flake8 --count --exit-zero --max-complexity=10 --statistics
- name: Type check with mypy
working-directory: asap-tools/data-sources/prometheus-exporters
run: mypy . --config-file=.mypy.ini
test-execution-utilities:
needs: detect-changes
if: needs.detect-changes.outputs.execution_utilities == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0
if [ -f asap-tools/execution-utilities/requirements.txt ]; then pip install -r asap-tools/execution-utilities/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-tools/execution-utilities
run: black --check --diff .
- name: Lint with flake8
working-directory: asap-tools/execution-utilities
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../../.flake8 --count --exit-zero --max-complexity=10 --statistics