Skip to content
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

ci: Use bare-metal OTEL runners for benchmark CI for pushes to main #2832

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow runs a Criterion benchmark on a PR and compares the results against the base branch.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra review facts:

  • This is actually a rename-and-change of pr_criterion, but git has got confused
  • For the branches that behave differently on push-to-main, i've tested they work by inverting the logic and pushing. I am confident the "template magic" is good.

# It is triggered on a PR or a push to main.
#
# The workflow is gated on the presence of the "performance" label on the PR.
#
# The workflow runs on a self-hosted runner pool. We can't use the shared runners for this,
# because they are only permitted to run on the default branch to preserve resources.
#
# In the future, we might like to consider using bencher.dev or the framework used by otel-golang here.
on:
pull_request:
push:
branches:
- main
name: benchmark pull requests
jobs:
runBenchmark:
name: run benchmark
permissions:
pull-requests: write

# If we're running on a PR, use ubuntu-latest - a shared runner. We can't use the self-hosted
# runners on arbitrary PRs, and we don't want to unleash that load on the pool anyway.
# If we're running on main, use the OTEL self-hosted runner pool.
runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-latest' || 'self-hosted' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch between the self-hosted (labelled PR) and ubuntu-latest (main)

if: |
${{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maintains our filter for the performance label being required to fire on a PR

github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'performance') ||
github.event_name == 'push'
}}
env:
# For PRs, compare against the base branch - e.g., 'main'.
# For pushes to main, compare against the previous commit
BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.base_ref || github.event.before }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This switches to compare to the previous commit if we are building for a push to main.

For PRs, we compare to the current state of main

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 10 # Fetch current commit and its parent
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: boa-dev/criterion-compare-action@v3
with:
cwd: opentelemetry
branchName: ${{ env.BRANCH_NAME }}
- uses: boa-dev/criterion-compare-action@v3
with:
cwd: opentelemetry-appender-tracing
features: spec_unstable_logs_enabled
branchName: ${{ env.BRANCH_NAME }}
- uses: boa-dev/criterion-compare-action@v3
with:
cwd: opentelemetry-sdk
features: rt-tokio,testing,metrics,logs,spec_unstable_metrics_views
branchName: ${{ env.BRANCH_NAME }}
31 changes: 0 additions & 31 deletions .github/workflows/pr_criterion.yaml

This file was deleted.

Loading