From 8cc94ed7e463f944422dad14847bbdfd9ca41676 Mon Sep 17 00:00:00 2001 From: Tyler Benson Date: Wed, 13 Sep 2023 16:02:08 -0400 Subject: [PATCH 1/2] Add Benchmark workflows These workflows run a few JMH benchmarks and publish the results to a `benchmarks` branch. The expectation is that the branch would be published via github pages. `benchmark-tags.yml` is intended to run manually as needed to populate benchmark data from historical versions. This works because the benchmarks being run have been in place for a long time. If we needed a new benchmark, methodologies would need to change. Note: this won't actually work until the org-level self-hosted runner is configured to allow these workflows. --- .github/workflows/benchmark-tags.yml | 74 ++++++++++++++++++++++++++++ .github/workflows/benchmark.yml | 43 ++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 .github/workflows/benchmark-tags.yml create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark-tags.yml b/.github/workflows/benchmark-tags.yml new file mode 100644 index 00000000000..96cb0c248fe --- /dev/null +++ b/.github/workflows/benchmark-tags.yml @@ -0,0 +1,74 @@ +name: Benchmark Tags + +on: + workflow_dispatch: + +jobs: + sdk-benchmark: + name: Benchmark SDK + runs-on: self-hosted + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + tag-version: + - v1.6.0 + - v1.7.0 + - v1.7.1 + - v1.10.0 + - v1.10.1 + - v1.11.0 + - v1.12.0 + - v1.13.0 + - v1.14.0 + - v1.15.0 + - v1.16.0 + - v1.17.0 + - v1.18.0 + - v1.19.0 + - v1.21.0 + - v1.22.0 + - v1.23.0 + - v1.23.1 + - v1.24.0 + - v1.25.0 + - v1.26.0 + - v1.27.0 + - v1.28.0 + - v1.29.0 + - v1.30.0 + - v1.30.1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ matrix.tag-version }} + + - id: setup-java + name: Set up Java for build + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - uses: gradle/gradle-build-action@v2 + with: + arguments: | + jmhJar + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + + - name: Run Benchmark + run: | + cd sdk/trace/build + java -jar libs/opentelemetry-sdk-trace-*-jmh.jar -rf json SpanBenchmark SpanPipelineBenchmark ExporterBenchmark + + - name: Store benchmark results + uses: benchmark-action/github-action-benchmark@v1 + with: + tool: 'jmh' + output-file-path: sdk/trace/build/jmh-result.json + gh-pages-branch: benchmarks + github-token: ${{ secrets.GITHUB_TOKEN }} + benchmark-data-dir-path: "" + auto-push: true + ref: ${{ matrix.tag-version }} diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 00000000000..9aaa9994b2e --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,43 @@ +name: Benchmark Main + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + sdk-benchmark: + name: Benchmark SDK + runs-on: self-hosted + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + + - id: setup-java + name: Set up Java for build + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - uses: gradle/gradle-build-action@v2 + with: + arguments: | + jmhJar + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + + - name: Run Benchmark + run: | + cd sdk/trace/build + java -jar libs/opentelemetry-sdk-trace-*-jmh.jar -rf json SpanBenchmark SpanPipelineBenchmark ExporterBenchmark + + - name: Store benchmark results + uses: benchmark-action/github-action-benchmark@v1 + with: + tool: 'jmh' + output-file-path: sdk/trace/build/jmh-result.json + gh-pages-branch: benchmarks + github-token: ${{ secrets.GITHUB_TOKEN }} + benchmark-data-dir-path: "" + auto-push: true From 40d20a84d94a92620eed481085ffad189b275869 Mon Sep 17 00:00:00 2001 From: Tyler Benson Date: Mon, 25 Sep 2023 14:46:14 -0400 Subject: [PATCH 2/2] Add branch protection settings for `benchmarks` --- .github/repository-settings.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/repository-settings.md b/.github/repository-settings.md index 0d836539b5e..e066f5fc18b 100644 --- a/.github/repository-settings.md +++ b/.github/repository-settings.md @@ -54,6 +54,14 @@ Same settings as above for `main`, except: (So that bot PR branches can be deleted) +### `benchmarks` + +- Everything UNCHECKED + + (This branch is currently only used for directly pushing benchmarking results from the + [overhead benchmark](https://github.com/open-telemetry/opentelemetry-java/actions/workflows/benchmark.yml) + job) + ## Secrets and variables > Actions * `GPG_PASSWORD` - stored in OpenTelemetry-Java 1Password