-
Notifications
You must be signed in to change notification settings - Fork 920
Add option to run benchmarks on PRs #7698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,94 @@ | ||
| name: Benchmark PR | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, labeled] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| BENCHMARK_MODULE: sdk/trace | ||
| BENCHMARK_CLASSES: SpanBenchmark SpanPipelineBenchmark ExporterBenchmark | ||
|
|
||
| jobs: | ||
| sdk-benchmark: | ||
| name: Benchmark SDK (Java ${{ matrix.test-java-version }}) | ||
| if: contains(github.event.pull_request.labels.*.name, 'run benchmarks') | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| test-java-version: | ||
| - 17 | ||
| runs-on: oracle-bare-metal-64cpu-512gb-x86-64 | ||
| container: | ||
| image: ubuntu:24.04@sha256:353675e2a41babd526e2b837d7ec780c2a05bca0164f7ea5dbbd433d21d166fc | ||
| timeout-minutes: 20 # since there is only a single bare metal runner across all repos | ||
| steps: | ||
| - name: Install Git | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y git | ||
|
|
||
| - name: Configure Git safe directory | ||
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
|
|
||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - id: setup-java-test | ||
| name: Set up Java ${{ matrix.test-java-version }} for tests | ||
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | ||
| with: | ||
| distribution: temurin | ||
| java-version: ${{ matrix.test-java-version }} | ||
|
|
||
| - id: setup-java | ||
| name: Set up Java for build | ||
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | ||
| with: | ||
| distribution: temurin | ||
| java-version: 17 | ||
|
|
||
| - name: Set up gradle | ||
| uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4.4.3 | ||
|
|
||
| - name: Build Benchmark | ||
| run: ./gradlew jmhJar | ||
|
|
||
| - name: Run Benchmark | ||
| run: > | ||
| ${{ steps.setup-java-test.outputs.path }}/bin/java | ||
| -jar ${{ env.BENCHMARK_MODULE }}/build/libs/opentelemetry-*-jmh.jar | ||
| -rf json | ||
| ${{ env.BENCHMARK_CLASSES }} | ||
|
|
||
| - name: Rename results | ||
| run: mv jmh-result.json jmh-result-pr.json | ||
|
|
||
| - name: Switch to main branch | ||
| run: git checkout origin/main | ||
|
|
||
| - name: Build Benchmark on main branch | ||
| run: ./gradlew jmhJar | ||
|
|
||
| - name: Run Benchmark on main branch | ||
| run: > | ||
| ${{ steps.setup-java-test.outputs.path }}/bin/java | ||
| -jar ${{ env.BENCHMARK_MODULE }}/build/libs/opentelemetry-*-jmh.jar | ||
| -rf json | ||
| ${{ env.BENCHMARK_CLASSES }} | ||
|
|
||
| - name: Rename results | ||
| run: mv jmh-result.json jmh-result-main.json | ||
|
|
||
| - name: Upload benchmark results | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| with: | ||
| name: benchmark-results-java-${{ matrix.test-java-version }} | ||
| path: | | ||
| jmh-result-pr.json | ||
| jmh-result-main.json | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the list from
opentelemetry-java/.github/workflows/benchmark.yml
Line 46 in 1e763b2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the third benchmark workflow
would it be possible to use the "reusable pattern" or alternatively use a script?