You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-05-22 09:35:21 +02:00
Fix benchmark ci (#8282)
Benchmark result: https://codspeed.io/open-telemetry/opentelemetry-go/branches/XSAM%3Afix-benchmark-ci The benchmark action is no longer compliant with 'Too many benchmarks in a single upload'. https://github.com/open-telemetry/opentelemetry-go/runs/73911767952 We can ignore the warning "Performance Regression: -80%" for now, as we don't have a proper benchmark baseline yet. --------- Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
@@ -34,6 +34,9 @@ jobs:
|
||||
shard: ${{ fromJson(needs.sharding-benchmark.outputs.shards) }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
# Bare metal uses Ubuntu 24.04, which does not have `make` and `build-essential`.
|
||||
- name: Install make and build-essential
|
||||
run: sudo apt-get update && sudo apt-get install -y make build-essential
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
with:
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
@@ -44,9 +47,12 @@ jobs:
|
||||
with:
|
||||
mode: walltime
|
||||
allow-empty: true
|
||||
# CodSpeed runs extremely slow when there are 128 processes involved, which is the number
|
||||
# of CPUs on the bare metal machine. Limiting the number of processes to 4 helps mitigate this. 4 also matches the number of CPUs on GitHub runners.
|
||||
#
|
||||
# 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
|
||||
run: GOMAXPROCS=4 make benchmark/${{matrix.shard}} ARGS=-benchtime=500ms
|
||||
|
||||
@@ -191,8 +191,16 @@ benchmark: $(OTEL_GO_MOD_DIRS:%=benchmark/%)
|
||||
benchmark/%:
|
||||
cd $* && $(GO) test -run='^$$' -bench=. $(ARGS) ./...
|
||||
|
||||
# sdk/metric is split into two shards to work around CodSpeed limitations.
|
||||
# See https://github.com/CodSpeedHQ/codspeed-go/issues/56
|
||||
BENCHMARK_SHARDS := $(filter-out ./sdk/metric,$(OTEL_GO_MOD_DIRS)) ./sdk/metric/root ./sdk/metric/internal
|
||||
benchmark/./sdk/metric/root:
|
||||
cd ./sdk/metric && $(GO) test -run='^$$' -bench=. $(ARGS) . ./exemplar/...
|
||||
benchmark/./sdk/metric/internal:
|
||||
cd ./sdk/metric && $(GO) test -run='^$$' -bench=. $(ARGS) ./internal/...
|
||||
|
||||
print-sharded-benchmarks:
|
||||
@echo $(OTEL_GO_MOD_DIRS) | jq -cR 'split(" ")'
|
||||
@echo $(BENCHMARK_SHARDS) | jq -cR 'split(" ")'
|
||||
|
||||
.PHONY: golangci-lint golangci-lint-fix
|
||||
golangci-lint-fix: ARGS=--fix
|
||||
|
||||
@@ -461,7 +461,8 @@ func BenchmarkExemplars(b *testing.B) {
|
||||
mp := NewMeterProvider(WithReader(r), WithView(v))
|
||||
return mp.Meter(name), r
|
||||
}
|
||||
nCPU := runtime.NumCPU() // Size of the fixed reservoir used.
|
||||
// Reads number of logical CPUs but respects GOMAXPROCS.
|
||||
nCPU := runtime.GOMAXPROCS(0) // Size of the fixed reservoir used.
|
||||
|
||||
b.Setenv("OTEL_GO_X_EXEMPLAR", "true")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user