From a83e627220e56ccf14f712285cd2dd3b1e6b4cd7 Mon Sep 17 00:00:00 2001 From: "(Eliseo) Nathaniel Ruiz Nowell" Date: Mon, 20 Dec 2021 14:21:16 -0800 Subject: [PATCH 1/2] Include propagator benchmarks + latest GH action * When we moved the aws-xray propagator in #720, we needed to update the benchmark step of the workflow * Additionally, the GH action has evolved since we added benchmarks so we should use the latest version --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a72cbcfc3..c91dc2ac6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,15 +47,15 @@ jobs: run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json - name: Find and merge benchmarks # TODO: Add at least one benchmark to every package type to remove this (#249) - if: matrix.package == 'sdkextension' + if: matrix.package == 'sdkextension' || matrix.package == 'propagator' run: >- jq -s '.[0].benchmarks = ([.[].benchmarks] | add) | if .[0].benchmarks == null then null else .[0] end' **/**/tests/*${{ matrix.package }}*-benchmark.json > output.json - name: Report on benchmark results # TODO: Add at least one benchmark to every package type to remove this (#249) - if: matrix.package == 'sdkextension' - uses: rhysd/github-action-benchmark@v1 + if: matrix.package == 'sdkextension' || matrix.package == 'propagator' + uses: benchmark-action/github-action-benchmark@v1 with: name: OpenTelemetry Python Benchmarks - Python ${{ env[matrix.python-version ]}} - ${{ matrix.package }} tool: pytest From 0f873cbfc0abad684dfdab3084a3dc909ea5204a Mon Sep 17 00:00:00 2001 From: "(Eliseo) Nathaniel Ruiz Nowell" Date: Mon, 20 Dec 2021 14:59:24 -0800 Subject: [PATCH 2/2] Merge all parallel benchmarks after they complete --- .github/workflows/test.yml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c91dc2ac6d..8bc5782d4e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,16 +45,39 @@ jobs: key: v4-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }} - name: run tox run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json - - name: Find and merge benchmarks + - name: Find and merge ${{ matrix.package }} benchmarks # TODO: Add at least one benchmark to every package type to remove this (#249) if: matrix.package == 'sdkextension' || matrix.package == 'propagator' run: >- + mkdir -p benchmarks; jq -s '.[0].benchmarks = ([.[].benchmarks] | add) | if .[0].benchmarks == null then null else .[0] end' - **/**/tests/*${{ matrix.package }}*-benchmark.json > output.json + **/**/tests/*${{ matrix.package }}*-benchmark.json > benchmarks/output_${{ matrix.package }}.json + - name: Upload all benchmarks under same key as an artifact + if: ${{ success() }} + uses: actions/upload-artifact@v2 + with: + name: benchmarks + path: benchmarks/output_${{ matrix.package }}.json + combine-benchmarks: + runs-on: ubuntu-latest + needs: build + if: ${{ always() }} + name: Combine benchmarks from previous build job + steps: + - name: Checkout Contrib Repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v2 + - name: Download all benchmarks as artifact using key + uses: actions/download-artifact@v2 + with: + name: benchmarks + path: benchmarks + - name: Find and merge all benchmarks + run: >- + jq -s '.[0].benchmarks = ([.[].benchmarks] | add) + | if .[0].benchmarks == null then null else .[0] end' + benchmarks/output_*.json > output.json; - name: Report on benchmark results - # TODO: Add at least one benchmark to every package type to remove this (#249) - if: matrix.package == 'sdkextension' || matrix.package == 'propagator' uses: benchmark-action/github-action-benchmark@v1 with: name: OpenTelemetry Python Benchmarks - Python ${{ env[matrix.python-version ]}} - ${{ matrix.package }}