1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00
Files
opentelemetry-go/.github/workflows/benchmark.yml
T
Sam Xie e413dfc153 Refactor benchmark CI (#7873)
Resolves #4537

This PR replaces the `github-action-benchmark` approach with CodSpeed.

CodSpeed addresses:
- The benchmark conflict issue:
https://github.com/open-telemetry/opentelemetry-go/issues/4537#issuecomment-2294034235
- The maintenance burden for GitHub pages.
- It allows partial performance test, which enables us to run benchmark
for PRs in the future

An example of benchmark result:
https://codspeed.io/XSAM/opentelemetry-go/runs/697aa351f5662999a88a8bf3

Benchmark page for opentelemetry-go:
https://codspeed.io/open-telemetry/opentelemetry-go

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2026-03-03 10:42:54 -08:00

53 lines
1.7 KiB
YAML

name: Benchmark
on:
push:
branches:
- main
workflow_dispatch:
# Declare default permissions as read only.
permissions: read-all
env:
DEFAULT_GO_VERSION: "~1.26.0"
jobs:
# Related issue: https://github.com/CodSpeedHQ/codspeed-go/issues/51
sharding-benchmark:
name: Sharding benchmarks
runs-on: ubuntu-latest
outputs:
shards: ${{ steps.sharding.outputs.shards }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- id: sharding
run: |
echo "shards=$(make print-sharded-benchmarks)" >> $GITHUB_OUTPUT
benchmark:
needs: sharding-benchmark
permissions:
contents: write # required for pushing to gh-pages branch
name: Benchmarks
runs-on: oracle-bare-metal-64cpu-512gb-x86-64
strategy:
matrix:
shard: ${{ fromJson(needs.sharding-benchmark.outputs.shards) }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: ${{ env.DEFAULT_GO_VERSION }}
check-latest: true
cache-dependency-path: "**/go.sum"
- name: Run the benchmarks
uses: CodSpeedHQ/action@v4.10.1
with:
mode: walltime
allow-empty: true
# CodSpeed overrides the default benchtime if we don't explicitly specify it.
# Having this would avoid running benchmark for more than 1 hour.
#
# The benchtime is adjusted to 500 ms to speed up the benchmark time.
# Per https://github.com/open-telemetry/community/issues/2331#issuecomment-2356403352
run: make benchmark/${{matrix.shard}} ARGS=-benchtime=500ms