Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b6db9d8
ci: build the PHP 7.0 extension variants in parallel jobs
bm1549 Nov 21, 2026
f216c69
ci: preload mimalloc in the Alpine Rust/LTO compile jobs
bm1549 Nov 21, 2026
ba645ee
ci: stop rebuilding bindgen-cli in the Alpine sidecar job
bm1549 Nov 20, 2026
9f3158d
ci: run installer tests in parallel
bm1549 Nov 21, 2026
5053265
ci: shard benchmarks-tracer into phpbench, opcache and tea jobs
bm1549 Nov 21, 2026
6809327
ci: skip the repository clone in system-tests jobs
bm1549 Nov 21, 2026
fb64b0d
ci: build system-tests weblogs with the docker driver
bm1549 Nov 21, 2026
fd06a24
ci: shard tracer-release system tests 8 ways
bm1549 Nov 21, 2026
563a2dc
ci: build tracer-release Rust with 16 codegen units
bm1549 Nov 21, 2026
a20f5e1
Merge branch 'master' into brian.marks/ci-pr-speedups
Leiyks Nov 24, 2026
9a8c339
ci: fail on unknown TRACER_PART or missing benchmark shard results
datadog-bits Nov 24, 2026
7319fbb
ci: install mimalloc in the Alpine compile image
datadog-bits Nov 24, 2026
1b6ce58
ci: drop unused PHP 7.0 standalone artifacts
datadog-bits Nov 24, 2026
75f765b
ci: keep one codegen unit on master, release branches and tags
datadog-bits Nov 24, 2026
c9232d4
ci: drop the benchmarking-platform step patcher
bm1549 Nov 24, 2026
db3ca52
ci: give installer tests a 50G DinD loopback
bm1549 Nov 24, 2026
520d86a
Merge remote-tracking branch 'origin/master' into brian.marks/ci-pr-s…
bm1549 Nov 24, 2026
669c476
ci: shard benchmarks-tracer on the in-repo bp-runner config
bm1549 Nov 24, 2026
019178e
ci: address automated review findings
bm1549 Nov 25, 2026
c533220
ci: run tracer benchmarks when the diff against master fails
bm1549 Nov 25, 2026
bc55f47
Merge branch 'master' into brian.marks/ci-pr-speedups
realFlowControl Nov 25, 2026
1810ce6
Merge branch 'master' into brian.marks/ci-pr-speedups
realFlowControl Nov 25, 2026
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
4 changes: 2 additions & 2 deletions .claude/ci/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

| CI Job | Image | What it does |
|--------|-------|--------------|
| `benchmarks-tracer` | `$MICROBENCHMARKS_CI_IMAGE` (see `.gitlab/benchmarks.yml`; built in-repo from `.gitlab/benchmarks/container/`) | Runs PHP tracer microbenchmarks via the Benchmarking Platform framework; skips automatically if no tracer-relevant files changed |
| `benchmarks-tracer` | `$MICROBENCHMARKS_CI_IMAGE` (see `.gitlab/benchmarks.yml`; built in-repo from `.gitlab/benchmarks/container/`) | Runs PHP tracer microbenchmarks via the Benchmarking Platform framework, one `TRACER_PART` (phpbench, phpbench-opcache, tea) per matrix job; skips automatically if no tracer-relevant files changed |
| `benchmarks-appsec` | same | Runs appsec microbenchmarks; produces `candidate.tar.gz` and `baseline.tar.gz` artifacts |
| `benchmarks-profiler` | same | Runs profiler microbenchmarks |
| `benchmarks-pr-comment` | `$MICROBENCHMARKS_CI_IMAGE` (see `.gitlab/benchmarks.yml`; built in-repo from `.gitlab/benchmarks/container/`) | Runs `.gitlab/benchmarks/bp-runner.pr-comment.yml`: posts the tracer comparison as a PR comment and uploads the results to the Benchmarking Platform API; needs `benchmarks-tracer`; allow_failure |
| `benchmarks-pr-comment-appsec` | same | Same flow for AppSec, with its own comment header; needs `benchmarks-appsec` |
| `benchmarks-pr-comment-profiler` | same | Same flow for the profiler, with its own comment header; needs `benchmarks-profiler` |
| `build-benchmark-ci-images` | (built in-repo from `.gitlab/benchmarks/container/`) | Manual job that builds the microbenchmark CI image from `.gitlab/benchmarks/container/`; described in `.gitlab/benchmarks/README.md` § How to rebuild the CI Docker image |
| `macrobenchmarks: [{PHP_VERSION}]` | `486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:php_laravel-realworld` | Runs a Laravel Realworld application under k6 load at three traffic levels; PHP 7.4 and 8.1 |
| `check-big-regressions` | `registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu@sha256:b682acae509fa391ac559705b66df07cac876e4c46641d2457077972a1c0bbb8` | Post-benchmark gate: fails if `benchmarks-tracer` results contain a regression above threshold |
| `check-big-regressions` | `registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu@sha256:b682acae509fa391ac559705b66df07cac876e4c46641d2457077972a1c0bbb8` | Post-benchmark gate: fails if `benchmarks-tracer` results contain a regression above threshold, or if any part's candidate results (or baseline results, when there is a baseline branch) are missing |
| `check-slo-breaches` | (benchmarking-platform-tools template) | Post-macrobenchmark gate: evaluates SLO breaches |
| `notify-slo-breaches` | (benchmarking-platform-tools template) | Posts SLO breach notifications to `#guild-dd-php` Slack channel |

Expand Down
27 changes: 20 additions & 7 deletions .claude/ci/compile-artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ stage. `make generate` produces three files via `classpreloader`:
|--------|-------|--------------|
| `prepare code` | `composer:2.10.3` | `.gitlab/append-build-id.sh` (bumps VERSION first) + `composer update` + `make generate`; produces VERSION + generated bridge files |
| `cache cargo deps: [{arch}, {triplet}]` | `dd-trace-ci:php-8.1_{platform}` (alpine uses `php-compile-extension-alpine-8.1`) | `cargo fetch` to warm the Cargo cache for the given target triplet |
| `compile tracing extension: [7.0, {arch}, {triplet}]` | `dd-trace-ci:php-7.0_{platform}` | Tracer-only path: `build-tracing.sh` produces legacy C archives, then `make xlang-lto` and `make build-ssi-ddtrace` replace NTS/ZTS self-contained and SSI DSOs. SSI rebuilds common without a PHP-ABI archive and checks it against the sidecar job’s canonical DSO. Debug remains non-LTO (GNU only). Outputs `extensions_{arch}/`, `standalone_{arch}/`, and legacy link metadata. |
| `compile tracing extension: [7.0, {arch}, {triplet}]` | `dd-trace-ci:php-7.0_{platform}` | Tracer-only static path: `build-tracing.sh` produces legacy C archives (including the GNU-only non-LTO debug archive) plus legacy link metadata. The DSOs it writes to `standalone_{arch}/` are not kept. Needs only `prepare code`. |
| `compile tracing extension LTO: [7.0, {arch}, {triplet}, {nts,zts}]` | `dd-trace-ci:php-7.0_{platform}` | `make xlang-lto` for one flavour; outputs the self-contained NTS or ZTS DSO in `extensions_{arch}/`. Needs only `prepare code`. |
| `compile tracing extension SSI: [7.0, {arch}, {triplet}]` | `dd-trace-ci:php-7.0_{platform}` | `make build-ssi-ddtrace` for NTS then ZTS; rebuilds common without a PHP-ABI archive and checks it against the sidecar job’s canonical DSO. Outputs `standalone_{arch}/`. |
| `compile tracing sidecar: [{arch}, {triplet}]` | `dd-trace-ci:php-8.1_{platform}` | `build-sidecar.sh` uses `build-xlang-lto ssi-common` to build `libdatadog_php_{arch}[-alpine].so` (common runtime plus embedded AppSec helper), once per platform. Also retains a Rust archive solely for the legacy debug link; it is not shipped. |
| `link tracing extension: [{arch}, {triplet}]` | `dd-trace-ci:php-8.1_{platform}` | Fans in PHP 7.0 and PHP 7.1+ combined artifacts. Skips already-built `.so` files, links the remaining legacy debug archive with matched LLD, and deletes intermediate `.a` files from `extensions_*`. |
| `aggregate tracing extension: [{arch}]` | `dd-trace-ci:php-7.4_bookworm-11` | No-op `ls` that collects the completed link-job artifacts for ordinary extension packaging. |
Expand Down Expand Up @@ -144,7 +146,7 @@ version for test jobs, not for release packaging.
```
prepare code + cache cargo deps
+-- compile combined extension (PHP 7.1+) ------------------.
+-- compile tracing extension (PHP 7.0) -------------------+-- link tracing extension
+-- compile tracing extension [LTO] (PHP 7.0) -------------+-- link tracing extension
+-- compile tracing sidecar (common DSO + legacy archive) -' |
| | v
| | aggregate tracing extension
Expand All @@ -155,7 +157,8 @@ prepare code + cache cargo deps
| |
+-- compile loader ---------------------------------------------+-- package loader
(+ common DSO
and PHP 7.0 SSI)
and compile tracing
extension SSI, PHP 7.0)
```

The separate ASAN and Windows
Expand All @@ -172,14 +175,24 @@ See `.gitlab/generate-package.php` for the exact per-platform `needs:` lists.
variants without a prebuilt DSO. `aggregate tracing extension` is a no-op
fan-in **after linking**, not a collector of all-version pre-link archives.

- `compile tracing sidecar` on alpine: the `-alpine` suffix variant force-installs
`bindgen-cli` via `cargo install --force --locked` before building, as a workaround
for `aws-lc-sys` build failures on musl targets.
- `compile tracing sidecar` on alpine uses the `bindgen-cli` the image installs in
`/usr/local/bin` (needed by `aws-lc-sys` on musl targets).

- The Cargo cache uses the default `pull-push` policy in `cache cargo deps` and
`policy: pull` (read-only) in `compile combined extension`, `compile SSI combined
extension`, and `compile tracing sidecar`. The PHP 7.0 `compile tracing extension`
has no explicit `cache:` block, but its release ThinLTO steps do build Rust.
LTO and SSI jobs have no explicit `cache:` block, but they do build Rust.

- The musl compile jobs (combined, SSI combined, sidecar and the PHP 7.0 jobs)
`LD_PRELOAD` the `mimalloc2-insecure` the Alpine image installs: Alpine's
rustc links scudo and clang/lld use musl's malloc, which spend much of a
parallel build in the kernel. Runners pull with `if-not-present`, so a node
can keep an older cached image after a rebuild; the jobs then `apk add` it.

- PR branch pipelines set `CARGO_PROFILE_TRACER_RELEASE_CODEGEN_UNITS=16`, which
roughly halves the Rust build. Master, `ddtrace-*`, `release-*` branches and
tags keep the profile's single codegen unit, so PR binaries are ~16-19% larger
than the shipped ones (relevant when a size check differs between the two).

- Windows compile jobs use Docker on the Windows runner (not DinD): the script starts a
long-lived container with `docker run -d`, then drives it via `docker exec`. The
Expand Down
9 changes: 7 additions & 2 deletions .claude/ci/package-dind-verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Docker-in-Docker runners because they spin up containers internally.
| CI Job | Image | What it does |
|--------|-------|--------------|
| `framework test: [{suite}]` | `docker:29.4.0-noble` | Spins up a framework-specific Docker Compose stack and runs the framework's own test suite with ddtrace installed |
| `installer tests` | `docker:29.4.0-noble` | Runs `make -C dockerfiles/verify_packages test_installer`; verifies `datadog-setup.php` installer works on both amd64 and arm64 packages |
| `installer tests` | `docker:29.4.0-noble` | Runs `make -C dockerfiles/verify_packages -j 8 --output-sync=target test_installer`; verifies `datadog-setup.php` installer works on both amd64 and arm64 packages |
| `randomized tests: [amd64, {no-asan,asan}, {1..5}]` | `docker:29.4.0-noble` | Generates random PHP scenarios and runs them with ddtrace for 1m30s each; checks for crashes and unexpected behavior |

Runner: `docker-in-docker:amd64`
Expand Down Expand Up @@ -210,7 +210,7 @@ docker-compose \
### installer tests

The installer tests (`make -C dockerfiles/verify_packages test_installer`) run
~39 test scripts. Each spins up a Docker container, runs
~44 test scripts, 8 at a time in CI. Each spins up a Docker container, runs
`php ./build/packages/datadog-setup.php --php-bin php`, and verifies the
installed extension version matches `cat VERSION`.

Expand Down Expand Up @@ -391,6 +391,11 @@ kill %1 # stop HTTP server
even on an amd64 runner, because `datadog-setup.php` is tested for its
ability to select the correct package.

- **`installer tests` sets `DOCKER_LOOPBACK_SIZE: 50G`.** Images and test
containers live on the DinD loopback, which defaults to 20G. With `-j 8`,
overlapping full-bundle extractions fill 20G (a 50G run wrote ~31G); serial
runs used ~11.5G.

- **`installer tests` VERSION mismatch.** The installer compares the installed
extension version against `VERSION`. CI runs `append-build-id.sh` which bumps
it (e.g. `1.17.0` -> `1.18.0+<sha>`). Without this step, tests fail with
Expand Down
6 changes: 5 additions & 1 deletion .claude/ci/system-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
**Source:** `.gitlab/generate-package.php` -- the `.system_tests` template and
individual job definitions immediately below it. The template defines the base
image, `before_script` (Docker + Python setup, clone of `system-tests` repo,
artifact placement, `./build.sh`), and artifact collection. Each concrete job
artifact placement, `./build.sh`), and artifact collection. The jobs set
`GIT_STRATEGY: none`: the `.gitlab` helpers they run come with the `prepare code`
artifacts. Weblogs build on the default docker driver (`USE_IMAGE_MIRROR=0`)
after their locked base images are pulled from the system-tests mirror and tagged
with their Docker Hub names; scenarios still use the mirror. Each concrete job
extends this template and runs `./run.sh` with the appropriate scenario.

| CI Job | Weblog | Scenario argument | What it does |
Expand Down
20 changes: 18 additions & 2 deletions .gitlab/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ workflow:
if [ "${CHECK_TRACER_FILE_CHANGES:-false}" = "true" ] && [ "${CI_PARENT_PIPELINE_SOURCE}" != "pipeline" ]; then
echo "Checking if tracer-related files changed..."
git fetch origin master:master 2>/dev/null || true
CHANGED_FILES=$(git diff --name-only HEAD master 2>/dev/null || echo "")
if ! CHANGED_FILES=$(git diff --name-only HEAD master); then
echo "Could not diff against master - running benchmarks"
CHANGED_FILES=benchmark/
fi
if ! echo "$CHANGED_FILES" | grep -q -E "^(ext/|src/|components/|components-rs/|zend_abstract_interface/|tests/Benchmarks/|benchmark/|tea/|\.gitlab/benchmarks\.yml|\.gitlab/benchmarks/)"; then
echo "No tracer-related file changes detected - skipping benchmark execution"
echo "Reports directory created but empty (no benchmarks needed)" > "${ARTIFACTS_DIR}/skip-reason.txt"
Expand Down Expand Up @@ -269,6 +272,9 @@ benchmarks-profiler:
benchmarks-tracer:
extends: .microbenchmarks
rules: *benchmarks-tracer-rules
parallel:
Comment thread
bm1549 marked this conversation as resolved.
Resolved
Comment thread
bm1549 marked this conversation as resolved.
Resolved
matrix:
- TRACER_PART: [ phpbench, phpbench-opcache, tea ]
artifacts:
name: "reports"
when: always
Expand Down Expand Up @@ -408,14 +414,24 @@ check-big-regressions:
tags: [ "arch:amd64" ]
image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu@sha256:b682acae509fa391ac559705b66df07cac876e4c46641d2457077972a1c0bbb8
script: |
if [ -f "reports/skip-reason.txt" ]; then
if [ -f "reports/skip-reason.txt" ] && ! ls reports/candidate*.converted.json >/dev/null 2>&1; then
echo "Benchmarks were skipped (no relevant file changes) - regression check not needed"
exit 0
elif [ -z "$(ls -A reports/ 2>/dev/null)" ]; then
echo "ERROR: Reports directory exists but is empty - benchmarks job had issues"
exit 1
else
echo "Reports directory found with content - running regression check"
sides=candidate
if [ -s reports/baseline_branch.txt ]; then sides="baseline candidate"; fi
for result in tracer-bench-results tracer-bench-results-opcache tracer-tea-bench-results; do
for side in $sides; do
if [ ! -f "reports/${side}-${result}.converted.json" ]; then
echo "ERROR: reports/${side}-${result}.converted.json is missing - a benchmarks-tracer shard had issues"
exit 1
fi
done
done
export ARTIFACTS_DIR="$(pwd)/reports/"
bp-runner "${CI_PROJECT_DIR}/.gitlab/benchmarks/bp-runner.fail-on-regression.yml" --debug
fi
Expand Down
12 changes: 9 additions & 3 deletions .gitlab/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ Execution flow on each PR:
runs `bp-runner .gitlab/benchmarks/bp-runner.yml`: hardware/software info
capture, Datadog agent, one-time setup, then the candidate and baseline
runs (the baseline is the PR's merge-target branch, at the merge base,
resolved by bp-runner's auto lookup).
resolved by bp-runner's auto lookup). `benchmarks-tracer` is a matrix of
three jobs, one per `TRACER_PART` (`phpbench`, `phpbench-opcache`, `tea`),
and `runall.sh` runs only that part. A baseline whose `runall.sh` predates
`TRACER_PART` runs the candidate's copy instead.
2. Each run's `benchmark/` suite results are saved as
`reports/$BASELINE_OR_CANDIDATE-<name>.<ext>` artifacts; only the AppSec job
also uploads the logs, tarred as `candidate.tar.gz`/`baseline.tar.gz`.
Expand All @@ -52,8 +55,11 @@ Execution flow on each PR:
`benchmarks-pr-comment*` jobs run their `bp-runner.pr-comment*.yml` to
push the converted results to the Benchmarking Platform API so they land on
the project's trend series.
4. `check-big-regressions` gates the pipeline on regressions above the
threshold of 10% in `bp-runner.fail-on-regression.yml`, and
4. `check-big-regressions` and `benchmarks-pr-comment` merge the three
tracer jobs' `reports/`. The gate fails if any part's candidate (or, when
there is a baseline branch, baseline) `.converted.json` is missing, or on
regressions above the threshold of 10% in
`bp-runner.fail-on-regression.yml`, and
`benchmarks-pr-comment*` comments the comparison on the PR.

## How to add a new microbenchmark
Expand Down
23 changes: 17 additions & 6 deletions .gitlab/benchmarks/bp-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,30 @@ experiments:
cd "$CODE_SRC/benchmark/"
rm -rf /tmp/logs/
mkdir -p /tmp/logs
# A baseline from before TRACER_PART existed would run every part.
if [ -n "${TRACER_PART:-}" ] && ! grep -q TRACER_PART runall.sh; then
cp "$CI_PROJECT_DIR/benchmark/runall.sh" runall.sh
fi
taskset -c 34-47 ./runall.sh

if [ "$SCENARIO" = "profiler" ]; then
mv "$ARTIFACTS_DIR/sirun_timeline.ndjson" "$ARTIFACTS_DIR/$BASELINE_OR_CANDIDATE-sirun_timeline.ndjson"
mv "$ARTIFACTS_DIR/sirun_exceptions.ndjson" "$ARTIFACTS_DIR/$BASELINE_OR_CANDIDATE-sirun_exceptions.ndjson"
elif [ "$SCENARIO" = "tracer" ]; then
# Give the OPCache subjects an "-opcache" suffix so they don't
# collide with the non-OPCache subjects (third column is the subject).
awk -F ',' -v OFS=',' 'NR == 1 { print } NR > 1 { $3 = $3 "-opcache"; print }' \
"$ARTIFACTS_DIR/tracer-bench-results-opcache.csv" > "$ARTIFACTS_DIR/tracer-bench-results-opcache.tmp" && \
if [ -z "${TRACER_PART:-}" ] || [ "$TRACER_PART" = phpbench-opcache ]; then
# Give the OPCache subjects an "-opcache" suffix so they don't
# collide with the non-OPCache subjects (third column is the subject).
awk -F ',' -v OFS=',' 'NR == 1 { print } NR > 1 { $3 = $3 "-opcache"; print }' \
"$ARTIFACTS_DIR/tracer-bench-results-opcache.csv" > "$ARTIFACTS_DIR/tracer-bench-results-opcache.tmp"
mv "$ARTIFACTS_DIR/tracer-bench-results-opcache.tmp" "$ARTIFACTS_DIR/$BASELINE_OR_CANDIDATE-tracer-bench-results-opcache.csv"
mv "$ARTIFACTS_DIR/tracer-bench-results.csv" "$ARTIFACTS_DIR/$BASELINE_OR_CANDIDATE-tracer-bench-results.csv"
mv "$ARTIFACTS_DIR/tracer-tea-bench-results.json" "$ARTIFACTS_DIR/$BASELINE_OR_CANDIDATE-tracer-tea-bench-results.json"
rm "$ARTIFACTS_DIR/tracer-bench-results-opcache.csv"
fi
if [ -z "${TRACER_PART:-}" ] || [ "$TRACER_PART" = phpbench ]; then
mv "$ARTIFACTS_DIR/tracer-bench-results.csv" "$ARTIFACTS_DIR/$BASELINE_OR_CANDIDATE-tracer-bench-results.csv"
fi
if [ -z "${TRACER_PART:-}" ] || [ "$TRACER_PART" = tea ]; then
mv "$ARTIFACTS_DIR/tracer-tea-bench-results.json" "$ARTIFACTS_DIR/$BASELINE_OR_CANDIDATE-tracer-tea-bench-results.json"
fi
elif [ "$SCENARIO" = "appsec" ]; then
# Give the AppSec subjects an "-appsec" suffix so they don't collide
# with the tracer subjects (third column is the subject).
Expand Down
5 changes: 2 additions & 3 deletions .gitlab/build-sidecar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ set -u

suffix="${1:-}"

# Workaround "error: failed to run custom build command for `aws-lc-sys v0.20.0`"
# The Alpine image ships bindgen-cli (alpine_compile_extension base.Dockerfile).
if [ "${suffix}" = "-alpine" ]; then
cargo install --force --locked bindgen-cli
export PATH="/root/.cargo/bin:$PATH"
command -v bindgen
fi

# Both release images have matched Clang/LLD and rust-src. The common DSO is
Expand Down
1 change: 1 addition & 0 deletions .gitlab/generate-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ function windows_git_setup_with_packages() {
'build-profiler.sh',
'xlang-lto', // `make -s xlang-lto` and tooling/bin/build-xlang-lto (ThinLTO and SSI combined builds)
'build-ssi-combined-alpine.sh',
'build-ssi-ddtrace',
];

// Split into top-level YAML blocks (each starts at column 0).
Expand Down
Loading
Loading