From e5d93fccb468163f60070d8b369479973f815c07 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Tue, 17 Nov 2026 11:30:51 +0100 Subject: [PATCH 01/16] Migrate microbenchmarks from benchmarking-platform into this repository Move the suite in-repo: container and gate config from the BP dd-trace-cpp branch (verbatim apart from path rewrites), the CI image built in-repo via the shared build-ci-images template, and the flow run on bp-runner configs (bp-runner.yml, bp-runner.pr-comment.yml) instead of step scripts. Baseline via bp-runner auto-resolution. --- .gitlab/BENCHMARKS.md | 30 ----- .gitlab/benchmarks.yml | 79 +++++++++++-- .gitlab/benchmarks/README.md | 106 ++++++++++++++++++ .../bp-runner.fail-on-regression.yml | 6 + .gitlab/benchmarks/bp-runner.pr-comment.yml | 10 ++ .gitlab/benchmarks/bp-runner.yml | 37 ++++++ .gitlab/benchmarks/container/Dockerfile | 4 + .../benchmarks/container/install-cpp-deps.sh | 23 ++++ 8 files changed, 254 insertions(+), 41 deletions(-) delete mode 100644 .gitlab/BENCHMARKS.md create mode 100644 .gitlab/benchmarks/README.md create mode 100644 .gitlab/benchmarks/bp-runner.fail-on-regression.yml create mode 100644 .gitlab/benchmarks/bp-runner.pr-comment.yml create mode 100644 .gitlab/benchmarks/bp-runner.yml create mode 100644 .gitlab/benchmarks/container/Dockerfile create mode 100755 .gitlab/benchmarks/container/install-cpp-deps.sh diff --git a/.gitlab/BENCHMARKS.md b/.gitlab/BENCHMARKS.md deleted file mode 100644 index c809df9d..00000000 --- a/.gitlab/BENCHMARKS.md +++ /dev/null @@ -1,30 +0,0 @@ -# Benchmarks - -This describes the GitLab CI configuration for the benchmarks that run on the -[Benchmarking Platform](https://datadoghq.atlassian.net/wiki/x/egAzk). - -## Layout - -- `benchmarks.yml`: Google Benchmark microbenchmarks. - - `benchmarks` clones `benchmarking-platform` (`dd-trace-cpp` branch), runs the benchmark, - converts and analyzes results, uploads and comments on the PR. - - `check-big-regressions` fails on regressions above the threshold defined on - `bp-runner.fail-on-regression.yml` in the `dd-trace-cpp` branch of - [benchmarking-platform](https://github.com/DataDog/benchmarking-platform). - -## Marking a Benchmark as Flaky - -Add it to `FLAKY_BENCHMARKS_REGEX` in the `benchmarks` job's `variables` in `benchmarks.yml`. - -The benchmark still runs and reports, but doesn't fail the gate. - -- The regex matches anywhere in the scenario name. - - `BM_Trace` quarantines every scenario containing it, like `BM_TraceTinyCCSource`. - - Anchor with `^...$` to target one scenario. - -```yaml -FLAKY_BENCHMARKS_REGEX: "^BM_TraceTinyCCSource$" -``` - -Open a ticket to fix or remove it. See -[Flaky Benchmarks Monitoring](https://datadoghq.atlassian.net/wiki/x/dAKLrgE) for more details. diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 14250c46..62457c77 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -1,5 +1,25 @@ +# The benchmarks CI image is built in-repo from .gitlab/benchmarks/container/ +# by the `build-benchmark-ci-images` job of the shared template. +# @see https://github.com/DataDog/benchmarking-platform-tools/blob/main/images/templates/gitlab/build-ci-images.template.yml +include: + - project: 'DataDog/benchmarking-platform-tools' + file: 'images/templates/gitlab/build-ci-images.template.yml' + variables: - BENCHMARKS_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:dd-trace-cpp + # Consumed by the benchmark jobs below. To rebuild the image, run the manual + # `build-benchmark-ci-images` job and repin to the tag it pushes + # (dd-trace-cpp-). + BENCHMARKS_CI_IMAGE: registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp-152931925 + + # Consumed by the included build-ci-images template. The per-pipeline + # suffix gives each build a unique tag. + BASE_CI_IMAGE_SUFFIX: dd-trace-cpp-${CI_PIPELINE_ID} + BASE_CI_IMAGE_CONTAINER_DIR: .gitlab/benchmarks/container + +# The template puts this job in the ci-image stage; run it next to the +# benchmarks it builds for instead. +build-benchmark-ci-images: + stage: benchmarks benchmarks: stage: benchmarks @@ -12,15 +32,12 @@ benchmarks: - interruptible: true timeout: 15m script: + # Keep the prelude: the gate and the insteadOf clone rewriting both + # depend on ARTIFACTS_DIR pointing at reports/ and on github.com/DataDog + # being rewritten to gitlab.ddbuild.io. - export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :) - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" - - git clone --branch dd-trace-cpp https://github.com/DataDog/benchmarking-platform /platform - - export PATH="$PATH:/platform/steps" - - capture-hardware-software-info.sh - - run-benchmarks.sh - - analyze-results.sh - - "upload-results-to-s3.sh || :" - - "post-pr-comment.sh || :" + - bp-runner .gitlab/benchmarks/bp-runner.yml --debug artifacts: name: "reports" when: always @@ -34,6 +51,48 @@ benchmarks: UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA # The commit revision the project is built for. # See https://datadoghq.atlassian.net/wiki/x/dAKLrgE for more details. FLAKY_BENCHMARKS_REGEX: "" + # Benchmark analyzer settings, previously exported by + # steps/config-benchmark-analyzer.sh. Every bp-runner step inherits the CI + # process environment, so the settings live here instead of the config. + UNCONFIDENCE_THRESHOLD: "2.0" + DISABLE_NHST: "1" + CI_TYPE: "theoretical" + MD_REPORT_ONLY_CHANGES: "1" + +# Posts the benchmark comparison on the PR and uploads the results to the +# Benchmarking Platform API. Allow-failure keeps a broken upload or a missing +# PR from blocking the gate, preserving the old `|| :` semantics, and running +# it in a separate job avoids the parallel-teardown race with the S3 upload. +benchmarks-pr-comment: + stage: benchmarks-report + needs: [ benchmarks ] + allow_failure: true + when: on_success + tags: ["arch:amd64"] + image: $BENCHMARKS_CI_IMAGE + timeout: 30m + rules: + - if: $CI_COMMIT_BRANCH == "main" + interruptible: false + - interruptible: true + variables: + # Benchmark analyzer settings, previously exported by + # steps/config-benchmark-analyzer.sh. The PR comment's comparison output + # depends on them. + UNCONFIDENCE_THRESHOLD: "2.0" + DISABLE_NHST: "1" + CI_TYPE: "theoretical" + MD_REPORT_ONLY_CHANGES: "1" + script: + - export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :) + - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" + - bp-runner .gitlab/benchmarks/bp-runner.pr-comment.yml --debug + artifacts: + name: "reports" + when: always + paths: + - reports/ + expire_in: 3 months # This repository is using PR-level performance quality gates. # Verify that the check-big-regressions CI job has passed. If any regression happened, merging this PR will be blocked. @@ -55,7 +114,5 @@ check-big-regressions: then git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" fi - git clone --branch dd-trace-cpp https://github.com/DataDog/benchmarking-platform /platform - export PATH="$PATH:/platform/steps" - bp-runner /platform/bp-runner.fail-on-regression.yml --debug + bp-runner "$CI_PROJECT_DIR/.gitlab/benchmarks/bp-runner.fail-on-regression.yml" --debug diff --git a/.gitlab/benchmarks/README.md b/.gitlab/benchmarks/README.md new file mode 100644 index 00000000..4e29acfd --- /dev/null +++ b/.gitlab/benchmarks/README.md @@ -0,0 +1,106 @@ +# Microbenchmarks + +The pipeline runs [Google Benchmark](https://github.com/google/benchmark) +microbenchmarks from `benchmark/` on the Benchmarking Platform, and compares them +against a baseline to detect regressions on every PR. + +Files in this directory: + +- **`bp-runner.yml`** — the experiment the `benchmarks` CI job runs with + `bp-runner`: fetch the candidate and baseline releases, run `bin/benchmark` + on each, analyze with the GoogleBenchmark converter, upload to S3. +- **`bp-runner.pr-comment.yml`** — the experiment the `benchmarks-pr-comment` + job runs with `bp-runner`: post the comparison comment on the PR and upload + to the BP API. The job is `allow_failure: true`, like the old `|| :` steps. +- **`container/`** — Dockerfile and install script for the benchmarks CI image. +- **`bp-runner.fail-on-regression.yml`** — gate config. The + `check-big-regressions` job runs it with `bp-runner` and fails the pipeline on + regressions above `regression_threshold`. + +Execution flow on each PR: + +1. The `benchmarks` job runs `bp-runner .gitlab/benchmarks/bp-runner.yml + --debug`: it collects hardware info, runs `benchmark/` twice (candidate and + baseline), converts and analyzes the results, and uploads them to S3. +2. The `benchmarks-pr-comment` job runs + `bp-runner .gitlab/benchmarks/bp-runner.pr-comment.yml --debug` and posts + the comparison on the PR. +3. The `check-big-regressions` job runs + `bp-runner.fail-on-regression.yml` and fails on regressions above the + threshold. + +## How to add a benchmark + +1. Write it in [`benchmark/`](../../benchmark/) using Google Benchmark, and add + the source file to `benchmark/CMakeLists.txt`. +2. Verify it runs locally (see below). + +New benchmarks that don't exist on the baseline branch are skipped from the +baseline comparison on the first run. + +## How to update a benchmark + +Edit the source in `benchmark/`. The experiment only builds and runs what is in +`benchmark/`, so no config change is needed to add, edit, or remove a +benchmark. Edit `bp-runner.yml` when the flow itself changes (fetch, run, +analyze, upload), and `container/` only when the toolchain changes. + +## How to mark a benchmark as flaky + +Add it to `FLAKY_BENCHMARKS_REGEX` in the `benchmarks` job's `variables` in +[`../benchmarks.yml`](../benchmarks.yml). The benchmark still runs and reports, +but it does not fail the gate. + +- The regex matches anywhere in the scenario name. + - `BM_Trace` quarantines every scenario containing it, like + `BM_TraceTinyCCSource`. + - Anchor with `^...$` to target one scenario. + +```yaml +FLAKY_BENCHMARKS_REGEX: "^BM_TraceTinyCCSource$" +``` + +Open a ticket to fix or remove it. See +[Flaky Benchmarks Monitoring](https://datadoghq.atlassian.net/wiki/x/dAKLrgE) +for more details. + +## How to run a benchmark locally + +From the repository root: + +```bash +bin/benchmark --benchmark_repetitions=10 --benchmark_format=json --benchmark_out=candidate.json +``` + +`bin/benchmark` builds `dd-trace-cpp` and the benchmark, then runs it. + +To run the full experiment locally, install `bp-runner` and run it against the +config, like the job does: + +```bash +export ARTIFACTS_DIR="$(pwd)/reports" +bp-runner .gitlab/benchmarks/bp-runner.yml --debug +``` + +Some steps need tools that only exist in the CI image (`benchmark_analyzer`, +`github-find-merge-into-branch`, `pr-commenter`). + +## How to rebuild the CI image + +The `BENCHMARKS_CI_IMAGE` used by the benchmark jobs is built from +`container/`. Rebuild and repin it whenever `container/` changes. + +1. Edit the files under `container/`. Push the branch. +2. On the pipeline, run the manual `build-benchmark-ci-images` job. It is + defined by + [`build-ci-images.template.yml`](https://github.com/DataDog/benchmarking-platform-tools/blob/main/images/templates/gitlab/build-ci-images.template.yml) + and pushes `registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp-`. +3. Copy the produced tag and the job URL, and pin + `BENCHMARKS_CI_IMAGE` in [`../benchmarks.yml`](../benchmarks.yml) to it: + +```yaml +# Image built here: +BENCHMARKS_CI_IMAGE: registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp- +``` + +4. Push the update and verify a green pipeline before merging. diff --git a/.gitlab/benchmarks/bp-runner.fail-on-regression.yml b/.gitlab/benchmarks/bp-runner.fail-on-regression.yml new file mode 100644 index 00000000..d6be11d7 --- /dev/null +++ b/.gitlab/benchmarks/bp-runner.fail-on-regression.yml @@ -0,0 +1,6 @@ +experiments: + - name: Run regression check + steps: + - name: Fail on regression + run: fail_on_regression + regression_threshold: 5.0 # percents diff --git a/.gitlab/benchmarks/bp-runner.pr-comment.yml b/.gitlab/benchmarks/bp-runner.pr-comment.yml new file mode 100644 index 00000000..f3741b73 --- /dev/null +++ b/.gitlab/benchmarks/bp-runner.pr-comment.yml @@ -0,0 +1,10 @@ +experiments: + - name: Post PR comment + steps: + - name: Post PR comment + run: post_pr_comment + +global_teardown: + - name: Upload to BP API + run: upload_to_bp_api + project: dd-trace-cpp diff --git a/.gitlab/benchmarks/bp-runner.yml b/.gitlab/benchmarks/bp-runner.yml new file mode 100644 index 00000000..97b67125 --- /dev/null +++ b/.gitlab/benchmarks/bp-runner.yml @@ -0,0 +1,37 @@ +# Analyzer settings (UNCONFIDENCE_THRESHOLD, DISABLE_NHST, CI_TYPE, +# MD_REPORT_ONLY_CHANGES) live in the CI job's `variables:`, not here. +# bp-runner configs have no top-level `env:`, and experiment env does not +# reach teardown steps. Every step inherits the CI process environment. + +global_setup: + - name: Capture hardware/software info + run: collect_hardware_software_info + +experiments: + - name: Microbenchmarks + steps: + - name: Run benchmarks + run: run_microbenchmarks + repo: DataDog/dd-trace-cpp + # The default fetch does not initialise submodules, and the benchmark + # binary needs the google-benchmark submodule. The clone follows the + # branch tip, so the submodules must be re-synced after the SHA + # checkout. + how_to_fetch_release: | + git clone --recurse-submodules --branch $BRANCH https://github.com/DataDog/dd-trace-cpp/ "$CODE_SRC" + cd "$CODE_SRC" && git checkout $COMMIT_SHA + git submodule update --init --recursive + # --benchmark_out makes the analyzer find the results file, named + # the way the fail-on-regression gate already globs. + how_to_run_benchmarks: | + bin/benchmark --benchmark_repetitions=10 --benchmark_format=json --benchmark_out="$ARTIFACTS_DIR/$BASELINE_OR_CANDIDATE.json" + + - name: Analyze results + run: analyze_microbenchmarks + framework: GoogleBenchmark + +global_teardown: + - name: Upload to S3 + run: upload_to_s3 + # If BP_EXTERNAL_S3_URL is empty, bp-runner uses its default S3 destination. + url: $BP_EXTERNAL_S3_URL diff --git a/.gitlab/benchmarks/container/Dockerfile b/.gitlab/benchmarks/container/Dockerfile new file mode 100644 index 00000000..f6ab5f83 --- /dev/null +++ b/.gitlab/benchmarks/container/Dockerfile @@ -0,0 +1,4 @@ +FROM registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:latest + +COPY install-cpp-deps.sh ./install-cpp-deps.sh +RUN ./install-cpp-deps.sh diff --git a/.gitlab/benchmarks/container/install-cpp-deps.sh b/.gitlab/benchmarks/container/install-cpp-deps.sh new file mode 100755 index 00000000..fa9f218f --- /dev/null +++ b/.gitlab/benchmarks/container/install-cpp-deps.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +apt-get update && apt-get install --yes software-properties-common && \ + add-apt-repository ppa:git-core/ppa --yes && \ + apt-get update && apt-get upgrade --yes && \ + apt-get install --yes \ + wget build-essential clang sed gdb clang-format git ssh shellcheck \ + libc++-dev libc++abi-dev + +git clone --branch main https://github.com/DataDog/dd-trace-cpp/ /dd-trace-cpp/ && cd /dd-trace-cpp/ +cp bin/install-cmake /tmp/install-cmake +chmod +x /tmp/install-cmake && /tmp/install-cmake && rm /tmp/install-cmake +cd / && rm -rf /dd-trace-cpp + +git clone https://github.com/google/benchmark.git +cd benchmark +cmake -E make_directory "build" +cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../ +cmake --build "build" --config Release +cmake -E chdir "build" ctest --build-config Release +cmake --build "build" --config Release --target install From 15893af31b79b2855b6f9617000586f39d92665f Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Tue, 17 Nov 2026 15:24:00 +0100 Subject: [PATCH 02/16] ci(benchmarks): drop the analyzer-settings comment from the bp-runner config --- .gitlab/benchmarks/bp-runner.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.gitlab/benchmarks/bp-runner.yml b/.gitlab/benchmarks/bp-runner.yml index 97b67125..710e6ec9 100644 --- a/.gitlab/benchmarks/bp-runner.yml +++ b/.gitlab/benchmarks/bp-runner.yml @@ -1,8 +1,3 @@ -# Analyzer settings (UNCONFIDENCE_THRESHOLD, DISABLE_NHST, CI_TYPE, -# MD_REPORT_ONLY_CHANGES) live in the CI job's `variables:`, not here. -# bp-runner configs have no top-level `env:`, and experiment env does not -# reach teardown steps. Every step inherits the CI process environment. - global_setup: - name: Capture hardware/software info run: collect_hardware_software_info From dc402a603f9299ba3f830eb9793d1da9f28d3a08 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Tue, 17 Nov 2026 15:24:43 +0100 Subject: [PATCH 03/16] docs(benchmarks): call the bp-runner files configurations, not experiments --- .gitlab/benchmarks/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/benchmarks/README.md b/.gitlab/benchmarks/README.md index 4e29acfd..4ea1ac9a 100644 --- a/.gitlab/benchmarks/README.md +++ b/.gitlab/benchmarks/README.md @@ -6,10 +6,10 @@ against a baseline to detect regressions on every PR. Files in this directory: -- **`bp-runner.yml`** — the experiment the `benchmarks` CI job runs with +- **`bp-runner.yml`** — the configuration the `benchmarks` CI job runs with `bp-runner`: fetch the candidate and baseline releases, run `bin/benchmark` on each, analyze with the GoogleBenchmark converter, upload to S3. -- **`bp-runner.pr-comment.yml`** — the experiment the `benchmarks-pr-comment` +- **`bp-runner.pr-comment.yml`** — the configuration the `benchmarks-pr-comment` job runs with `bp-runner`: post the comparison comment on the PR and upload to the BP API. The job is `allow_failure: true`, like the old `|| :` steps. - **`container/`** — Dockerfile and install script for the benchmarks CI image. From 3eb3a688af92095f7b2fbf3684c172a146b3d66f Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Tue, 17 Nov 2026 17:17:53 +0100 Subject: [PATCH 04/16] ci(benchmarks): retry S3 upload on failure --- .gitlab/benchmarks/bp-runner.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab/benchmarks/bp-runner.yml b/.gitlab/benchmarks/bp-runner.yml index 710e6ec9..f7b0df7b 100644 --- a/.gitlab/benchmarks/bp-runner.yml +++ b/.gitlab/benchmarks/bp-runner.yml @@ -28,5 +28,8 @@ experiments: global_teardown: - name: Upload to S3 run: upload_to_s3 + # S3 upload failures are usually transient and the upload is idempotent, + # so retry twice before failing the job (3 attempts total). + retries_on_failure: 2 # If BP_EXTERNAL_S3_URL is empty, bp-runner uses its default S3 destination. url: $BP_EXTERNAL_S3_URL From 178d65e276afab7a5694ffa2476e3073ffd172bb Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Tue, 17 Nov 2026 17:29:46 +0100 Subject: [PATCH 05/16] docs(benchmarks): tighten comments --- .gitlab/benchmarks.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 62457c77..d7cc03be 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -11,7 +11,7 @@ variables: # (dd-trace-cpp-). BENCHMARKS_CI_IMAGE: registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp-152931925 - # Consumed by the included build-ci-images template. The per-pipeline + # The per-pipeline # suffix gives each build a unique tag. BASE_CI_IMAGE_SUFFIX: dd-trace-cpp-${CI_PIPELINE_ID} BASE_CI_IMAGE_CONTAINER_DIR: .gitlab/benchmarks/container @@ -51,18 +51,16 @@ benchmarks: UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA # The commit revision the project is built for. # See https://datadoghq.atlassian.net/wiki/x/dAKLrgE for more details. FLAKY_BENCHMARKS_REGEX: "" - # Benchmark analyzer settings, previously exported by - # steps/config-benchmark-analyzer.sh. Every bp-runner step inherits the CI - # process environment, so the settings live here instead of the config. + # Analyzer settings. Every bp-runner step inherits the CI process environment, + # so the settings live here instead of the config. UNCONFIDENCE_THRESHOLD: "2.0" DISABLE_NHST: "1" CI_TYPE: "theoretical" MD_REPORT_ONLY_CHANGES: "1" -# Posts the benchmark comparison on the PR and uploads the results to the -# Benchmarking Platform API. Allow-failure keeps a broken upload or a missing -# PR from blocking the gate, preserving the old `|| :` semantics, and running -# it in a separate job avoids the parallel-teardown race with the S3 upload. +# Posts the comparison and uploads results. allow_failure preserves the old || : +# semantics, and a separate job avoids the parallel-teardown race with the S3 +# upload. benchmarks-pr-comment: stage: benchmarks-report needs: [ benchmarks ] @@ -76,9 +74,7 @@ benchmarks-pr-comment: interruptible: false - interruptible: true variables: - # Benchmark analyzer settings, previously exported by - # steps/config-benchmark-analyzer.sh. The PR comment's comparison output - # depends on them. + # Analyzer settings the PR comment's comparison output depends on. UNCONFIDENCE_THRESHOLD: "2.0" DISABLE_NHST: "1" CI_TYPE: "theoretical" From 09faaa02a163eebcf2bf23348b55790252346f84 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Thu, 26 Nov 2026 10:31:30 +0100 Subject: [PATCH 06/16] ci(benchmarks): slim down the CI image dependencies Drop the ppa:git-core repository and the apt upgrade, and drop the packages nothing uses (clang, clang-format, gdb, libc++-dev, libc++abi-dev, shellcheck, ssh). Keep wget and sed because bin/install-cmake needs them, and fetch install-cmake with a depth-1 clone of the repository. Delete the manual Google Benchmark install: the benchmark suite builds it from the benchmark/google-benchmark submodule. --- .gitlab/benchmarks/container/Dockerfile | 2 +- .../benchmarks/container/install-cpp-deps.sh | 27 ++++++------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.gitlab/benchmarks/container/Dockerfile b/.gitlab/benchmarks/container/Dockerfile index f6ab5f83..dea0c937 100644 --- a/.gitlab/benchmarks/container/Dockerfile +++ b/.gitlab/benchmarks/container/Dockerfile @@ -1,4 +1,4 @@ FROM registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:latest -COPY install-cpp-deps.sh ./install-cpp-deps.sh +COPY install-cpp-deps.sh . RUN ./install-cpp-deps.sh diff --git a/.gitlab/benchmarks/container/install-cpp-deps.sh b/.gitlab/benchmarks/container/install-cpp-deps.sh index fa9f218f..e81109ee 100755 --- a/.gitlab/benchmarks/container/install-cpp-deps.sh +++ b/.gitlab/benchmarks/container/install-cpp-deps.sh @@ -2,22 +2,11 @@ set -e -apt-get update && apt-get install --yes software-properties-common && \ - add-apt-repository ppa:git-core/ppa --yes && \ - apt-get update && apt-get upgrade --yes && \ - apt-get install --yes \ - wget build-essential clang sed gdb clang-format git ssh shellcheck \ - libc++-dev libc++abi-dev - -git clone --branch main https://github.com/DataDog/dd-trace-cpp/ /dd-trace-cpp/ && cd /dd-trace-cpp/ -cp bin/install-cmake /tmp/install-cmake -chmod +x /tmp/install-cmake && /tmp/install-cmake && rm /tmp/install-cmake -cd / && rm -rf /dd-trace-cpp - -git clone https://github.com/google/benchmark.git -cd benchmark -cmake -E make_directory "build" -cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../ -cmake --build "build" --config Release -cmake -E chdir "build" ctest --build-config Release -cmake --build "build" --config Release --target install +apt-get update && apt-get install --yes build-essential git sed wget + +git clone --depth 1 --branch main https://github.com/DataDog/dd-trace-cpp/ /dd-trace-cpp/ +cd /dd-trace-cpp +chmod +x bin/install-cmake +bin/install-cmake +rm -rf /dd-trace-cpp +cd / From aff7db7eedd5e9036b54f5564a8c0f0c48e2fa25 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Thu, 26 Nov 2026 10:31:57 +0100 Subject: [PATCH 07/16] ci(benchmarks): simplify the release fetch in bp-runner.yml The benchmark binary needs the google-benchmark and tinycc submodules, not just google-benchmark. Drop --recurse-submodules from the git clone; the later git submodule update --init --recursive already initialises them after the SHA checkout. Quote $BRANCH and $COMMIT_SHA. --- .gitlab/benchmarks/bp-runner.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab/benchmarks/bp-runner.yml b/.gitlab/benchmarks/bp-runner.yml index f7b0df7b..acdcc071 100644 --- a/.gitlab/benchmarks/bp-runner.yml +++ b/.gitlab/benchmarks/bp-runner.yml @@ -9,12 +9,10 @@ experiments: run: run_microbenchmarks repo: DataDog/dd-trace-cpp # The default fetch does not initialise submodules, and the benchmark - # binary needs the google-benchmark submodule. The clone follows the - # branch tip, so the submodules must be re-synced after the SHA - # checkout. + # binary needs the google-benchmark and tinycc submodules. how_to_fetch_release: | - git clone --recurse-submodules --branch $BRANCH https://github.com/DataDog/dd-trace-cpp/ "$CODE_SRC" - cd "$CODE_SRC" && git checkout $COMMIT_SHA + git clone --branch "$BRANCH" https://github.com/DataDog/dd-trace-cpp/ "$CODE_SRC" + cd "$CODE_SRC" && git checkout "$COMMIT_SHA" git submodule update --init --recursive # --benchmark_out makes the analyzer find the results file, named # the way the fail-on-regression gate already globs. From a8ba50dfc9c585bebeddaa0dad17414b66b87d83 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Thu, 26 Nov 2026 10:32:51 +0100 Subject: [PATCH 08/16] ci(benchmarks): factorize analyzer settings, rules, and artifacts The four analyzer settings variables, the rules block, and the reports artifacts block were duplicated across the benchmark jobs. Anchor them at the top of the file and reference them from each job. Values are unchanged. --- .gitlab/benchmarks.yml | 60 ++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index d7cc03be..43fea67f 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -5,6 +5,24 @@ include: - project: 'DataDog/benchmarking-platform-tools' file: 'images/templates/gitlab/build-ci-images.template.yml' +.analyzer-settings: &analyzer-settings + UNCONFIDENCE_THRESHOLD: "2.0" + DISABLE_NHST: "1" + CI_TYPE: "theoretical" + MD_REPORT_ONLY_CHANGES: "1" + +.benchmarks-rules: &benchmarks-rules + - if: $CI_COMMIT_BRANCH == "main" + interruptible: false + - interruptible: true + +.reports-artifacts: &reports-artifacts + name: "reports" + when: always + paths: + - reports/ + expire_in: 3 months + variables: # Consumed by the benchmark jobs below. To rebuild the image, run the manual # `build-benchmark-ci-images` job and repin to the tag it pushes @@ -26,10 +44,7 @@ benchmarks: when: on_success tags: ["runner:apm-k8s-tweaked-metal"] image: $BENCHMARKS_CI_IMAGE - rules: - - if: $CI_COMMIT_BRANCH == "main" - interruptible: false - - interruptible: true + rules: *benchmarks-rules timeout: 15m script: # Keep the prelude: the gate and the insteadOf clone rewriting both @@ -38,12 +53,7 @@ benchmarks: - export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :) - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" - bp-runner .gitlab/benchmarks/bp-runner.yml --debug - artifacts: - name: "reports" - when: always - paths: - - reports/ - expire_in: 3 months + artifacts: *reports-artifacts variables: UPSTREAM_PROJECT_ID: $CI_PROJECT_ID # The ID of the current project. This ID is unique across all projects on the GitLab instance. UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME # "dd-trace-cpp" @@ -51,12 +61,8 @@ benchmarks: UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA # The commit revision the project is built for. # See https://datadoghq.atlassian.net/wiki/x/dAKLrgE for more details. FLAKY_BENCHMARKS_REGEX: "" - # Analyzer settings. Every bp-runner step inherits the CI process environment, - # so the settings live here instead of the config. - UNCONFIDENCE_THRESHOLD: "2.0" - DISABLE_NHST: "1" - CI_TYPE: "theoretical" - MD_REPORT_ONLY_CHANGES: "1" + # Analyzer settings. + <<: *analyzer-settings # Posts the comparison and uploads results. allow_failure preserves the old || : # semantics, and a separate job avoids the parallel-teardown race with the S3 @@ -69,26 +75,15 @@ benchmarks-pr-comment: tags: ["arch:amd64"] image: $BENCHMARKS_CI_IMAGE timeout: 30m - rules: - - if: $CI_COMMIT_BRANCH == "main" - interruptible: false - - interruptible: true + rules: *benchmarks-rules variables: # Analyzer settings the PR comment's comparison output depends on. - UNCONFIDENCE_THRESHOLD: "2.0" - DISABLE_NHST: "1" - CI_TYPE: "theoretical" - MD_REPORT_ONLY_CHANGES: "1" + <<: *analyzer-settings script: - export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :) - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" - bp-runner .gitlab/benchmarks/bp-runner.pr-comment.yml --debug - artifacts: - name: "reports" - when: always - paths: - - reports/ - expire_in: 3 months + artifacts: *reports-artifacts # This repository is using PR-level performance quality gates. # Verify that the check-big-regressions CI job has passed. If any regression happened, merging this PR will be blocked. @@ -98,10 +93,7 @@ check-big-regressions: stage: benchmarks-report needs: [ benchmarks ] when: on_success - rules: - - if: $CI_COMMIT_BRANCH == "main" - interruptible: false - - interruptible: true + rules: *benchmarks-rules tags: ["arch:amd64"] image: $BENCHMARKS_CI_IMAGE script: | From f278f41a2a2b1a1e4ebd03f9063b4e466214d3fe Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Thu, 26 Nov 2026 10:34:33 +0100 Subject: [PATCH 09/16] docs(benchmarks): sort the file list and capitalize section titles Sort the directory listing bullets alphabetically and capitalize the section titles. Replace the em-dashes in the file list with colons. --- .gitlab/benchmarks/README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.gitlab/benchmarks/README.md b/.gitlab/benchmarks/README.md index 4ea1ac9a..b3122a15 100644 --- a/.gitlab/benchmarks/README.md +++ b/.gitlab/benchmarks/README.md @@ -6,16 +6,16 @@ against a baseline to detect regressions on every PR. Files in this directory: -- **`bp-runner.yml`** — the configuration the `benchmarks` CI job runs with - `bp-runner`: fetch the candidate and baseline releases, run `bin/benchmark` - on each, analyze with the GoogleBenchmark converter, upload to S3. -- **`bp-runner.pr-comment.yml`** — the configuration the `benchmarks-pr-comment` - job runs with `bp-runner`: post the comparison comment on the PR and upload - to the BP API. The job is `allow_failure: true`, like the old `|| :` steps. -- **`container/`** — Dockerfile and install script for the benchmarks CI image. -- **`bp-runner.fail-on-regression.yml`** — gate config. The +- **`bp-runner.fail-on-regression.yml`**: gate config. The `check-big-regressions` job runs it with `bp-runner` and fails the pipeline on regressions above `regression_threshold`. +- **`bp-runner.pr-comment.yml`**: the configuration the `benchmarks-pr-comment` + job runs with `bp-runner`: post the comparison comment on the PR and upload + to the BP API. The job is `allow_failure: true`, like the old `|| :` steps. +- **`bp-runner.yml`**: the configuration the `benchmarks` CI job runs with + `bp-runner`: fetch the candidate and baseline releases, run `bin/benchmark` + on each, analyze with the GoogleBenchmark converter, upload to S3. +- **`container/`**: Dockerfile and install script for the benchmarks CI image. Execution flow on each PR: @@ -29,7 +29,7 @@ Execution flow on each PR: `bp-runner.fail-on-regression.yml` and fails on regressions above the threshold. -## How to add a benchmark +## How to Add a Benchmark 1. Write it in [`benchmark/`](../../benchmark/) using Google Benchmark, and add the source file to `benchmark/CMakeLists.txt`. @@ -38,14 +38,14 @@ Execution flow on each PR: New benchmarks that don't exist on the baseline branch are skipped from the baseline comparison on the first run. -## How to update a benchmark +## How to Update a Benchmark Edit the source in `benchmark/`. The experiment only builds and runs what is in `benchmark/`, so no config change is needed to add, edit, or remove a benchmark. Edit `bp-runner.yml` when the flow itself changes (fetch, run, analyze, upload), and `container/` only when the toolchain changes. -## How to mark a benchmark as flaky +## How to Mark a Benchmark as Flaky Add it to `FLAKY_BENCHMARKS_REGEX` in the `benchmarks` job's `variables` in [`../benchmarks.yml`](../benchmarks.yml). The benchmark still runs and reports, @@ -64,7 +64,7 @@ Open a ticket to fix or remove it. See [Flaky Benchmarks Monitoring](https://datadoghq.atlassian.net/wiki/x/dAKLrgE) for more details. -## How to run a benchmark locally +## How to Run a Benchmark Locally From the repository root: @@ -85,7 +85,7 @@ bp-runner .gitlab/benchmarks/bp-runner.yml --debug Some steps need tools that only exist in the CI image (`benchmark_analyzer`, `github-find-merge-into-branch`, `pr-commenter`). -## How to rebuild the CI image +## How to Rebuild the CI Image The `BENCHMARKS_CI_IMAGE` used by the benchmark jobs is built from `container/`. Rebuild and repin it whenever `container/` changes. From f023a9943af35338ecd381b5f748725c4e24bfee Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Thu, 26 Nov 2026 10:52:10 +0100 Subject: [PATCH 10/16] ci(benchmarks): repin the image to the slimmed-down build 156635051 --- .gitlab/benchmarks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 43fea67f..a4be5505 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -27,7 +27,7 @@ variables: # Consumed by the benchmark jobs below. To rebuild the image, run the manual # `build-benchmark-ci-images` job and repin to the tag it pushes # (dd-trace-cpp-). - BENCHMARKS_CI_IMAGE: registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp-152931925 + BENCHMARKS_CI_IMAGE: registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp-156635051 # The per-pipeline # suffix gives each build a unique tag. From 928bed47a9d6ee269d9a570d3a291606660be18f Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Fri, 27 Nov 2026 15:39:47 +0100 Subject: [PATCH 11/16] ci(benchmarks): tidy comments in benchmarks.yml Merge a split comment, drop a comment that repeats the code, and describe allow_failure without referring to removed code. --- .gitlab/benchmarks.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index a4be5505..496042c7 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -29,8 +29,7 @@ variables: # (dd-trace-cpp-). BENCHMARKS_CI_IMAGE: registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp-156635051 - # The per-pipeline - # suffix gives each build a unique tag. + # The per-pipeline suffix gives each build a unique tag. BASE_CI_IMAGE_SUFFIX: dd-trace-cpp-${CI_PIPELINE_ID} BASE_CI_IMAGE_CONTAINER_DIR: .gitlab/benchmarks/container @@ -61,12 +60,11 @@ benchmarks: UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA # The commit revision the project is built for. # See https://datadoghq.atlassian.net/wiki/x/dAKLrgE for more details. FLAKY_BENCHMARKS_REGEX: "" - # Analyzer settings. <<: *analyzer-settings -# Posts the comparison and uploads results. allow_failure preserves the old || : -# semantics, and a separate job avoids the parallel-teardown race with the S3 -# upload. +# Posts the comparison and uploads results. allow_failure keeps a failure here +# from failing the pipeline, and a separate job avoids the parallel-teardown +# race with the S3 upload. benchmarks-pr-comment: stage: benchmarks-report needs: [ benchmarks ] From 2c2805dffacec41a6e2156f247267106fa629c35 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Fri, 27 Nov 2026 15:40:18 +0100 Subject: [PATCH 12/16] ci(benchmarks): share the bp-runner prelude across jobs The three bp-runner jobs repeated the same ARTIFACTS_DIR and git insteadOf setup. Move it to a .bp-runner-prelude before_script. Drop the CI_JOB_TOKEN check, which is always true in a GitLab job. --- .gitlab/benchmarks.yml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 496042c7..d4757dfe 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -23,6 +23,13 @@ include: - reports/ expire_in: 3 months +# bp-runner writes reports to ARTIFACTS_DIR. The insteadOf rule makes clones +# of github.com/DataDog go through gitlab.ddbuild.io. +.bp-runner-prelude: + before_script: + - export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :) + - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" + variables: # Consumed by the benchmark jobs below. To rebuild the image, run the manual # `build-benchmark-ci-images` job and repin to the tag it pushes @@ -39,6 +46,7 @@ build-benchmark-ci-images: stage: benchmarks benchmarks: + extends: .bp-runner-prelude stage: benchmarks when: on_success tags: ["runner:apm-k8s-tweaked-metal"] @@ -46,11 +54,6 @@ benchmarks: rules: *benchmarks-rules timeout: 15m script: - # Keep the prelude: the gate and the insteadOf clone rewriting both - # depend on ARTIFACTS_DIR pointing at reports/ and on github.com/DataDog - # being rewritten to gitlab.ddbuild.io. - - export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :) - - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" - bp-runner .gitlab/benchmarks/bp-runner.yml --debug artifacts: *reports-artifacts variables: @@ -66,6 +69,7 @@ benchmarks: # from failing the pipeline, and a separate job avoids the parallel-teardown # race with the S3 upload. benchmarks-pr-comment: + extends: .bp-runner-prelude stage: benchmarks-report needs: [ benchmarks ] allow_failure: true @@ -78,8 +82,6 @@ benchmarks-pr-comment: # Analyzer settings the PR comment's comparison output depends on. <<: *analyzer-settings script: - - export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :) - - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" - bp-runner .gitlab/benchmarks/bp-runner.pr-comment.yml --debug artifacts: *reports-artifacts @@ -88,17 +90,12 @@ benchmarks-pr-comment: # If bypassing is necessary, see https://datadoghq.atlassian.net/wiki/spaces/APMINT/pages/5158175217/Performance+quality+gates+-+User+Guide for more details. check-big-regressions: + extends: .bp-runner-prelude stage: benchmarks-report needs: [ benchmarks ] when: on_success rules: *benchmarks-rules tags: ["arch:amd64"] image: $BENCHMARKS_CI_IMAGE - script: | - export ARTIFACTS_DIR="$(pwd)/reports/" - if [[ -n "$CI_JOB_TOKEN" ]]; - then - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/" - fi - - bp-runner "$CI_PROJECT_DIR/.gitlab/benchmarks/bp-runner.fail-on-regression.yml" --debug + script: + - bp-runner .gitlab/benchmarks/bp-runner.fail-on-regression.yml --debug From 1fdc47483cfcfe3b14110305fde7d1c7c6315674 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Fri, 27 Nov 2026 15:40:19 +0100 Subject: [PATCH 13/16] ci(benchmarks): simplify install-cpp-deps.sh bin/install-cmake is already executable and does not depend on the working directory, so call it by path. --- .gitlab/benchmarks/container/install-cpp-deps.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab/benchmarks/container/install-cpp-deps.sh b/.gitlab/benchmarks/container/install-cpp-deps.sh index e81109ee..24e7b49f 100755 --- a/.gitlab/benchmarks/container/install-cpp-deps.sh +++ b/.gitlab/benchmarks/container/install-cpp-deps.sh @@ -5,8 +5,5 @@ set -e apt-get update && apt-get install --yes build-essential git sed wget git clone --depth 1 --branch main https://github.com/DataDog/dd-trace-cpp/ /dd-trace-cpp/ -cd /dd-trace-cpp -chmod +x bin/install-cmake -bin/install-cmake +/dd-trace-cpp/bin/install-cmake rm -rf /dd-trace-cpp -cd / From 9ae512d1885677738bea8339eb3183ea124b34b8 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Fri, 27 Nov 2026 15:40:20 +0100 Subject: [PATCH 14/16] ci(benchmarks): stop the release fetch on the first error --- .gitlab/benchmarks/bp-runner.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/benchmarks/bp-runner.yml b/.gitlab/benchmarks/bp-runner.yml index acdcc071..ac084ad9 100644 --- a/.gitlab/benchmarks/bp-runner.yml +++ b/.gitlab/benchmarks/bp-runner.yml @@ -11,6 +11,7 @@ experiments: # The default fetch does not initialise submodules, and the benchmark # binary needs the google-benchmark and tinycc submodules. how_to_fetch_release: | + set -e git clone --branch "$BRANCH" https://github.com/DataDog/dd-trace-cpp/ "$CODE_SRC" cd "$CODE_SRC" && git checkout "$COMMIT_SHA" git submodule update --init --recursive From 4b279da89d0da52b06a2c26a5d1a2059c6d0396b Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Fri, 27 Nov 2026 15:40:32 +0100 Subject: [PATCH 15/16] docs(benchmarks): trim the README file list and the image repin step The execution flow already explains what each job does, so the file list only names each config. The repin step no longer asks for the job URL, which benchmarks.yml does not keep. --- .gitlab/benchmarks/README.md | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.gitlab/benchmarks/README.md b/.gitlab/benchmarks/README.md index b3122a15..cb8d5268 100644 --- a/.gitlab/benchmarks/README.md +++ b/.gitlab/benchmarks/README.md @@ -6,15 +6,10 @@ against a baseline to detect regressions on every PR. Files in this directory: -- **`bp-runner.fail-on-regression.yml`**: gate config. The - `check-big-regressions` job runs it with `bp-runner` and fails the pipeline on - regressions above `regression_threshold`. -- **`bp-runner.pr-comment.yml`**: the configuration the `benchmarks-pr-comment` - job runs with `bp-runner`: post the comparison comment on the PR and upload - to the BP API. The job is `allow_failure: true`, like the old `|| :` steps. -- **`bp-runner.yml`**: the configuration the `benchmarks` CI job runs with - `bp-runner`: fetch the candidate and baseline releases, run `bin/benchmark` - on each, analyze with the GoogleBenchmark converter, upload to S3. +- **`bp-runner.fail-on-regression.yml`**: `bp-runner` config for the regression + gate. +- **`bp-runner.pr-comment.yml`**: `bp-runner` config for the PR comment. +- **`bp-runner.yml`**: `bp-runner` config for the benchmark run. - **`container/`**: Dockerfile and install script for the benchmarks CI image. Execution flow on each PR: @@ -23,8 +18,8 @@ Execution flow on each PR: --debug`: it collects hardware info, runs `benchmark/` twice (candidate and baseline), converts and analyzes the results, and uploads them to S3. 2. The `benchmarks-pr-comment` job runs - `bp-runner .gitlab/benchmarks/bp-runner.pr-comment.yml --debug` and posts - the comparison on the PR. + `bp-runner .gitlab/benchmarks/bp-runner.pr-comment.yml --debug`, posts + the comparison on the PR, and uploads the results to the BP API. 3. The `check-big-regressions` job runs `bp-runner.fail-on-regression.yml` and fails on regressions above the threshold. @@ -95,11 +90,10 @@ The `BENCHMARKS_CI_IMAGE` used by the benchmark jobs is built from defined by [`build-ci-images.template.yml`](https://github.com/DataDog/benchmarking-platform-tools/blob/main/images/templates/gitlab/build-ci-images.template.yml) and pushes `registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp-`. -3. Copy the produced tag and the job URL, and pin - `BENCHMARKS_CI_IMAGE` in [`../benchmarks.yml`](../benchmarks.yml) to it: +3. Copy the produced tag, and pin `BENCHMARKS_CI_IMAGE` in + [`../benchmarks.yml`](../benchmarks.yml) to it: ```yaml -# Image built here: BENCHMARKS_CI_IMAGE: registry.ddbuild.io/ci/benchmarking-platform:dd-trace-cpp- ``` From 5119c0a2952e06eef1d23a6d63167b7f3a725717 Mon Sep 17 00:00:00 2001 From: Augusto de Oliveira Date: Fri, 27 Nov 2026 15:43:06 +0100 Subject: [PATCH 16/16] docs(benchmarks): name the job and config instead of "experiment" "Experiment" is a bp-runner term the README never defines. Say the benchmarks job and the bp-runner.yml flow instead. --- .gitlab/benchmarks/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab/benchmarks/README.md b/.gitlab/benchmarks/README.md index cb8d5268..5c152750 100644 --- a/.gitlab/benchmarks/README.md +++ b/.gitlab/benchmarks/README.md @@ -35,8 +35,8 @@ baseline comparison on the first run. ## How to Update a Benchmark -Edit the source in `benchmark/`. The experiment only builds and runs what is in -`benchmark/`, so no config change is needed to add, edit, or remove a +Edit the source in `benchmark/`. The `benchmarks` job only builds and runs what +is in `benchmark/`, so no config change is needed to add, edit, or remove a benchmark. Edit `bp-runner.yml` when the flow itself changes (fetch, run, analyze, upload), and `container/` only when the toolchain changes. @@ -69,8 +69,8 @@ bin/benchmark --benchmark_repetitions=10 --benchmark_format=json --benchmark_out `bin/benchmark` builds `dd-trace-cpp` and the benchmark, then runs it. -To run the full experiment locally, install `bp-runner` and run it against the -config, like the job does: +To run the full `bp-runner.yml` flow locally, install `bp-runner` and run it +against the config, like the job does: ```bash export ARTIFACTS_DIR="$(pwd)/reports"