Export workflow metrics (BETA) #494
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
name: Export workflow metrics (BETA) | |
on: | |
workflow_run: | |
workflows: | |
- Android ARM64 with vcpkg | |
- Documentation | |
- Cleanup PIP caches | |
- Code snippets | |
- Code Style | |
- Code coverage | |
- Coverity (Ubuntu 20.04, Python 3.11) | |
- Fedora (RHEL), Python 3.9 | |
- Linux (Ubuntu 20.04, Python 3.11) | |
- Linux ARM64 (Ubuntu 20.04, Python 3.11) | |
- Linux Static CC (Ubuntu 22.04, Python 3.11, Clang) | |
- Linux RISC-V with Conan (Ubuntu 22.04, Python 3.10) | |
- macOS (Python 3.11) | |
- macOS ARM64 (Python 3.11) | |
- MO | |
- Python API Checks | |
- Webassembly | |
- Windows (VS 2019, Python 3.11) | |
- Windows Conditional Compilation (VS 2022, Python 3.11) | |
- Rerun Workflow with Known Errors | |
types: | |
- completed | |
permissions: read-all | |
jobs: | |
otel-export-trace: | |
name: Export finished workflow metrics | |
runs-on: aks-linux-2-cores-8gb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
sparse-checkout: '.github' | |
- name: Install deps | |
run: | | |
pip3 install -r .github/scripts/requirements.txt | |
# dependency review action has these as an exception | |
# yet it still complains, so install them here | |
pip3 install PyGithub==2.2.0 psycopg2-binary==2.9.9 | |
- name: Send metrics to SQL database | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RUN_ID: ${{ github.event.workflow_run.id }} | |
PGHOST: ${{ secrets.METRICS_DATABASE_HOST }} | |
PGUSER: ${{ secrets.METRICS_DATABASE_USERNAME }} | |
PGPASSWORD: ${{ secrets.METRICS_DATABASE_PASSWORD }} | |
PGDATABASE: ${{ secrets.METRICS_DATABASE_NAME }} | |
PGPORT: 5432 | |
LOGLEVEL: "${{ runner.debug == '1' && 'DEBUG' || 'INFO' }}" | |
run: | | |
python3 .github/scripts/collect_github_metrics.py \ | |
--run-id ${{ github.event.workflow_run.id }} \ | |
--repository-name ${GITHUB_REPOSITORY} |