1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00

Update the benchmarks to only record/display select benchmarks. (#4560)

* Add a benchmark target to makefile

* update CI to reflect how the benchmarks will be used

* Add auto-push to benchmarks branch.

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
Aaron Clawson
2023-10-12 12:00:18 -05:00
committed by GitHub
parent f14dc1281d
commit 8a923d0c7a
4 changed files with 38 additions and 5 deletions
+9 -4
View File
@@ -1,21 +1,24 @@
name: Benchmark
on:
push:
branches:
- main
tags:
- v1.*
workflow_dispatch:
env:
DEFAULT_GO_VERSION: "~1.21.3"
jobs:
benchmark:
name: Benchmarks
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ env.DEFAULT_GO_VERSION }}
- name: Run benchmarks
run: make test-bench | tee output.txt
run: make benchmark | tee output.txt
- name: Download previous benchmark data
uses: actions/cache@v3
with:
@@ -28,6 +31,8 @@ jobs:
tool: 'go'
output-file-path: output.txt
external-data-json-path: ./benchmarks/data.json
auto-push: false
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-pages-branch: benchmarks
auto-push: true
fail-on-alert: false
alert-threshold: "400%"
+16
View File
@@ -45,6 +45,22 @@ jobs:
run: make build
- name: Check clean repository
run: make check-clean-work-tree
test-bench:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.DEFAULT_GO_VERSION }}
cache-dependency-path: "**/go.sum"
- name: Run benchmarks to check functionality
run: make test-bench
test-race:
runs-on: ubuntu-latest
+12
View File
@@ -192,6 +192,18 @@ test-coverage: | $(GOCOVMERGE)
done; \
$(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt
# Adding a directory will include all benchmarks in that direcotry if a filter is not specified.
BENCHMARK_TARGETS := sdk/trace
.PHONY: benchmark
benchmark: $(BENCHMARK_TARGETS:%=benchmark/%)
BENCHMARK_FILTER = .
# You can override the filter for a particular directory by adding a rule here.
benchmark/sdk/trace: BENCHMARK_FILTER = SpanWithAttributes_8/AlwaysSample
benchmark/%:
@echo "$(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(BENCHMARK_FILTER) $*..." \
&& cd $* \
$(foreach filter, $(BENCHMARK_FILTER), && $(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(filter))
.PHONY: golangci-lint golangci-lint-fix
golangci-lint-fix: ARGS=--fix
golangci-lint-fix: golangci-lint
@@ -676,7 +676,7 @@ func BenchmarkPrepend(b *testing.B) {
func BenchmarkAppend(b *testing.B) {
for i := 0; i < b.N; i++ {
agg := newExpoHistogramDataPoint[float64](1024, 200, false, false)
agg := newExpoHistogramDataPoint[float64](1024, 20, false, false)
n := smallestNonZeroNormalFloat64
for j := 0; j < 1024; j++ {
agg.record(n)