Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f40c169
feat: combine tracing and profiling in ddtrace.so
morrisonlevi Aug 30, 2026
971b955
fix: validate standalone profiler CI artifacts
morrisonlevi Aug 30, 2026
ca6a1d1
fix: use configured PHP metadata in Rust builds
morrisonlevi Aug 30, 2026
6024083
fix: generate combined configuration metadata
morrisonlevi Aug 30, 2026
98431bd
fix: align profiling metadata with registry
morrisonlevi Aug 30, 2026
88621a8
fix: pass PHP includes to ZAI Rust build
morrisonlevi Aug 30, 2026
9cf8445
fix: configure split Rust extension builds
morrisonlevi Aug 30, 2026
de2d811
fix: configure tracing sidecar Rust builds
morrisonlevi Aug 31, 2026
266c20a
fix: rebuild profiler for selected PHP ABI
morrisonlevi Aug 31, 2026
80941de
fix: isolate PHP compiler flags on Windows
morrisonlevi Aug 31, 2026
383a07f
fix: initialize tracer defaults before request config
morrisonlevi Aug 31, 2026
fd887c8
build: silence Cargo with quiet Make
morrisonlevi Aug 31, 2026
bcfbb62
fix: share DD_TAGS map configuration
morrisonlevi Aug 31, 2026
06df13e
Merge remote-tracking branch 'origin/master' into levi/common-extensi…
morrisonlevi Aug 31, 2026
e49d0b4
ci: build combined extension artifacts directly
morrisonlevi Sep 1, 2026
5e509a2
test: stabilize loader checks on Alpine
morrisonlevi Sep 1, 2026
05bd941
fix: weaken PHP symbols in Rust archives
morrisonlevi Sep 2, 2026
4fa7b2b
Merge remote-tracking branch origin/master into levi/common-extension-2
morrisonlevi Sep 2, 2026
44e6a29
ci: report package artifact sizes
morrisonlevi Sep 2, 2026
1a67c96
test: expect combined loader configuration output
morrisonlevi Sep 2, 2026
24260eb
build: remove intermediate extension archives
morrisonlevi Sep 2, 2026
04981fc
build: discard unused extension sections
morrisonlevi Sep 3, 2026
1a2aa1b
test: match combined JIT configuration order
morrisonlevi Sep 3, 2026
71972a9
build: optimize packaged PHP debug artifacts
morrisonlevi Sep 3, 2026
37a72b8
test: fix loader/profiler test gaps for combined ddtrace.so
morrisonlevi Sep 3, 2026
2e36827
build: fix stale Rust archive reuse across NTS/ZTS configure runs
morrisonlevi Sep 4, 2026
1084a4f
Merge remote-tracking branch 'origin/master' into levi/common-extensi…
morrisonlevi Sep 4, 2026
a2d86db
profiling: init logger before other MINIT logging
morrisonlevi Sep 4, 2026
911a33c
ci: allow overriding system-tests repo/ref for system_tests jobs
morrisonlevi Sep 4, 2026
588d607
build: export DDTRACE_PHP_INCLUDES for SSI split-build Rust invocations
morrisonlevi Sep 4, 2026
fb429bd
Fix N -> 10
morrisonlevi Sep 5, 2026
0a3ae85
build: add compile_combined/install_combined Makefile targets
morrisonlevi Sep 5, 2026
35dacd9
ci: raise lib-injection image size threshold to match measured growth
morrisonlevi Sep 5, 2026
6c5d0e8
Merge remote-tracking branch 'origin/master' into levi/common-extensi…
morrisonlevi Sep 8, 2026
473db63
Merge remote-tracking branch 'origin/master' into levi/common-extensi…
morrisonlevi Sep 9, 2026
6df11ac
ci(appsec): fix buildPortableLibdatadogPhp missing DDTRACE_PHP_INCLUDES
morrisonlevi Sep 9, 2026
9917491
Revert "ci(appsec): fix buildPortableLibdatadogPhp missing DDTRACE_PH…
morrisonlevi Sep 9, 2026
e49ec89
fix: move profiling's config codegen out of components-rs/build.rs
morrisonlevi Sep 10, 2026
aa93c7e
fix: use real PHP headers for config codegen, drop stub headers
morrisonlevi Sep 10, 2026
8bc9941
test(prof): disable sidecar/telemetry in pcntl helper-thread phpt
morrisonlevi Sep 10, 2026
2f72f24
test(appsec): avoid sidecar restart race
morrisonlevi Sep 10, 2026
c50cf70
test(installer): support legacy profiler versions
morrisonlevi Sep 10, 2026
dae7e04
Merge remote-tracking branch 'origin/master' into levi/common-extensi…
morrisonlevi Sep 10, 2026
1fc782b
ci: use HTTPS for Alpine package repositories
morrisonlevi Sep 10, 2026
a7e1807
Merge remote-tracking branch 'origin/master' into levi/common-extensi…
morrisonlevi Sep 10, 2026
8418fde
fix: use one ASan runtime for Rust builds
morrisonlevi Sep 10, 2026
cad341d
ci: install libcurl for profiler correctness
morrisonlevi Sep 10, 2026
2b2e827
ci: preserve PHP runtime dependencies
morrisonlevi Sep 10, 2026
a3052be
fix(installer): support legacy profiler packages
morrisonlevi Sep 10, 2026
ee98168
test(prof): accept combined module frames
morrisonlevi Sep 10, 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
12 changes: 6 additions & 6 deletions .claude/ci/appsec-native-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ file.

| CI Job | Image | What it does |
|--------|-------|-------------|
| `test appsec extension: [{ver}, {arch}, debug]` | `datadog/dd-trace-ci:php-{ver}_bookworm-6` | Builds appsec PHP extension + runs phpunit `.phpt` tests |
| `test appsec extension: [{ver}, {arch}, debug]` | `datadog/dd-trace-ci:php-{ver}_bookworm-10` | Builds appsec PHP extension + runs phpunit `.phpt` tests |
| `test appsec extension: [{ver}, {arch}, debug-zts]` | same | ZTS variant |
| `test appsec extension: [{ver}, {arch}, debug-zts-asan]` | same | ASAN variant (PHP 7.4+) |
| `appsec lint` | `datadog/dd-trace-ci:php-8.3_bookworm-6` | clang-format + clang-tidy |
| `appsec code coverage` | `datadog/dd-trace-ci:php-8.3_bookworm-6` | Coverage instrumented build (not needed locally) |
| `appsec lint` | `datadog/dd-trace-ci:php-8.3_bookworm-10` | clang-format + clang-tidy |
| `appsec code coverage` | `datadog/dd-trace-ci:php-8.3_bookworm-10` | Coverage instrumented build (not needed locally) |

Runner: `arch:amd64` + `arch:arm64`
Matrix: PHP 7.0+ × {debug, debug-zts, debug-zts-asan (7.4+)}
Expand All @@ -24,7 +24,7 @@ Docker option between the image name and `--`:

```bash
.claude/ci/dockerh --cache appsec-ext-8.3-debug-arm64 --overlayfs --php debug \
datadog/dd-trace-ci:php-8.3_bookworm-6 --platform linux/arm64 -- bash -c '...'
datadog/dd-trace-ci:php-8.3_bookworm-10 --platform linux/arm64 -- bash -c '...'
```

## Why `--overlayfs` is needed
Expand All @@ -42,7 +42,7 @@ All commands are run from the repo root. Replace `8.3` with the desired PHP vers

```bash
.claude/ci/dockerh --cache appsec-ext-8.3-debug --overlayfs --php debug \
datadog/dd-trace-ci:php-8.3_bookworm-6 -- bash -c '
datadog/dd-trace-ci:php-8.3_bookworm-10 -- bash -c '
set -e
sudo apt-get update -qq && sudo apt-get install -y -qq \
libc++-17-dev libc++abi-17-dev > /dev/null 2>&1
Expand Down Expand Up @@ -89,7 +89,7 @@ to save ~10 seconds:

```bash
.claude/ci/dockerh --cache appsec-ext-8.3-debug --overlayfs --php debug \
datadog/dd-trace-ci:php-8.3_bookworm-6 -- bash -c '
datadog/dd-trace-ci:php-8.3_bookworm-10 -- bash -c '
sudo apt-get update -qq && sudo apt-get install -y -qq \
libc++-17-dev libc++abi-17-dev > /dev/null 2>&1
cd appsec/build
Expand Down
8 changes: 4 additions & 4 deletions .claude/ci/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ the link, so no special handling is needed.

```bash
.claude/ci/dockerh --cache bench-82 --clean-cache --overlayfs --root \
datadog/dd-trace-ci:php-8.2_bookworm-6 \
datadog/dd-trace-ci:php-8.2_bookworm-10 \
-e DD_TRACE_AUTOLOAD_NO_COMPILE=true \
-- bash -c '
git config --global --add safe.directory /project/dd-trace-php
Expand All @@ -93,7 +93,7 @@ Build step (skip if `.so` already in overlay or downloaded from CI):

```bash
.claude/ci/dockerh --cache bench-82-split --overlayfs --root \
datadog/dd-trace-ci:php-8.2_bookworm-6 \
datadog/dd-trace-ci:php-8.2_bookworm-10 \
-e SHARED=1 \
-e CI_COMMIT_SHA=$(git rev-parse HEAD) \
-e CI_COMMIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
Expand All @@ -104,7 +104,7 @@ Benchmark step (every run — the ext dir is outside the overlay):

```bash
.claude/ci/dockerh --cache bench-82-split --overlayfs --root \
datadog/dd-trace-ci:php-8.2_bookworm-6 \
datadog/dd-trace-ci:php-8.2_bookworm-10 \
-e SHARED=1 \
-e DD_TRACE_AUTOLOAD_NO_COMPILE=true \
-- bash -c '
Expand Down Expand Up @@ -135,7 +135,7 @@ tooling/bin/download-artifacts \

# Place it in the overlay via bind-mount
.claude/ci/dockerh --cache bench-82-dl --overlayfs --root \
datadog/dd-trace-ci:php-8.2_bookworm-6 \
datadog/dd-trace-ci:php-8.2_bookworm-10 \
-v /tmp/bench-ext:/tmp/bench-ext:ro \
-- bash -c '
mkdir -p tmp/build_extension/modules
Expand Down
79 changes: 59 additions & 20 deletions .claude/ci/building-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Used before running tracer unit tests, .phpt tests, etc.:

```bash
.claude/ci/dockerh --cache tracer-8.3-debug --overlayfs --php debug \
datadog/dd-trace-ci:php-8.3_bookworm-6 -- bash -c '
datadog/dd-trace-ci:php-8.3_bookworm-10 -- bash -c '
set -e
git submodule update --init libdatadog
make -j$(nproc) all
Expand Down Expand Up @@ -132,7 +132,7 @@ Reproduces the `compile extension: debug` CI job exactly:

```bash
.claude/ci/dockerh --cache tracer-8.3-debug --overlayfs --root \
datadog/dd-trace-ci:php-8.3_bookworm-6 \
datadog/dd-trace-ci:php-8.3_bookworm-10 \
-e CI_COMMIT_SHA=$(git rev-parse HEAD) \
-e CI_COMMIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
-e SHARED=1 \
Expand All @@ -150,7 +150,7 @@ enables `-fsanitize=address` in the Rust sidecar.
```bash
.claude/ci/dockerh --cache tracer-8.3-asan --overlayfs \
--php debug-zts-asan \
datadog/dd-trace-ci:php-8.3_bookworm-6 -- bash -c '
datadog/dd-trace-ci:php-8.3_bookworm-10 -- bash -c '
set -e
export COMPILE_ASAN=1
make -j$(nproc) all
Expand Down Expand Up @@ -210,41 +210,74 @@ helper artifact.

## Profiler Extension

### For correctness tests (bookworm)
**Do not run `phpize`/`configure` directly in the repo root** -- it overwrites
the tracked top-level `Makefile` (and `Makefile.fragments`/`Makefile.objects`)
with a generated one, corrupting the checkout for every other target. Always
go through the root `Makefile`'s own targets below, which copy sources into an
isolated `tmp/build_{combined,profiler}/` directory (via the `all` target's
`$(BUILD_DIR)/configure` prerequisite) before running `phpize`/`configure`/`make`
there -- the checked-out root `Makefile`/`configure` are never touched.

`CARGO_TARGET_DIR` **must** be set explicitly (see
[github-actions-profiler.md](github-actions-profiler.md) for why):
### Combined tracer+profiler (preferred -- matches what CI ships)

Most local profiler work should build the **combined** `ddtrace.so` (tracer +
profiling in one extension), since that's the only artifact CI packages and
tests as of the combined-extension milestone. Use `make compile_combined`
(or `make install_combined` to also copy it into the PHP extension dir and
register it via `ddtrace.ini`):

```bash
dockerh --cache profiler-8.3-nts --php nts \
datadog/dd-trace-ci:php-8.3_bookworm-6 -- bash -c '
export CARGO_TARGET_DIR=/project/dd-trace-php/target
cd profiling && cargo rustc --features=trigger_time_sample \
--profile profiler-release --crate-type=cdylib
datadog/dd-trace-ci:php-8.3_bookworm-10 -- bash -c '
cd /project/dd-trace-php
make compile_combined -j"$(nproc)"
php -n -d extension=tmp/build_combined/modules/ddtrace.so --ri ddtrace
'
```

`compile_combined` sets `EXTRA_CONFIGURE_OPTIONS="--enable-ddtrace-tracer
--enable-ddtrace-profiling"` and `DDTRACE_PROFILING_FEATURES=trigger_time_sample`,
and builds in `tmp/build_combined/` (`BUILD_SUFFIX=combined`) so it doesn't
collide with a plain tracer-only `tmp/build_extension/` build in the same
checkout.

### Standalone profiler (only for testing the standalone artifact itself)

The standalone `datadog-profiling.so` (no tracer) is not built or shipped by
CI anymore -- only use this when specifically testing standalone/combined
conflict behavior or other standalone-specific code paths, not as a general
substitute for the combined build above:

```bash
dockerh --cache profiler-8.3-nts-standalone --php nts \
datadog/dd-trace-ci:php-8.3_bookworm-10 -- bash -c '
cd /project/dd-trace-php
make compile_profiler -j"$(nproc)"
php -n -d extension=tmp/build_profiler/modules/datadog-profiling.so --ri datadog-profiling
'
```

### For release / packaging / system tests (centos-7)

Bookworm is too recent for binary compatibility purposes.

`build-profiler.sh` takes two arguments: the output directory prefix
and the thread safety mode (`nts` or `zts`). It calls `switch-php`
internally, so use `--root` (not `--php`). The output prefix must
match the directory layout expected by `generate-final-artifact.sh`:
`datadog-profiling/{triplet}/lib/php/{PHP_API}/`.
`build-profiler.sh` takes an output directory prefix, the thread safety mode
(`nts` or `zts`), and an optional `combined` artifact mode. Package jobs use
combined mode. It calls `switch-php` internally, so use `--root` (not
`--php`). The output prefix must match the directory layout expected by
`generate-final-artifact.sh`: `combined-ddtrace/{triplet}/lib/php/{PHP_API}/`.

Build one PHP version at a time (each centos-7 image ships one
version). For a single version (e.g. 8.2, ABI `20220829`):

```bash
.claude/ci/dockerh --cache compile-profiler-8.2-gnu --overlayfs \
.claude/ci/dockerh --cache compile-combined-8.2-gnu --overlayfs \
--root \
datadog/dd-trace-ci:php-8.2_centos-7 \
-e CI_COMMIT_SHA=$(git rev-parse HEAD) \
-e CI_COMMIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
-- bash -c 'PHP_VERSION=8.2 bash .gitlab/build-profiler.sh \
datadog-profiling/x86_64-unknown-linux-gnu/lib/php/20220829 nts'
combined-ddtrace/x86_64-unknown-linux-gnu/lib/php/20220829 nts combined'
```

## Sidecar (Rust)
Expand Down Expand Up @@ -297,10 +330,16 @@ platforms and fails if artifacts are missing.
compiled `.so` files:
- `extensions_$(uname -m)/` — ddtrace extensions
(`ddtrace-{API}[-zts|-debug|-debug-zts].so`)
- `appsec_$(uname -m)/` — appsec extensions (`ddappsec-{API}[-zts].so`)
- `appsec_$(uname -m)/` — appsec extensions (`ddappsec-{API}[-zts].so`); the
helper is now embedded in the sidecar (see `packaging-oci.md`), so there are
no separate `libddappsec-helper*.so` inputs anymore
- `appsec/recommended.json` — bundled AppSec rules
- `datadog-profiling/{triplet}/lib/php/{API}/` — profiler
extensions
- `extensions_$(uname -m)/` also supplies the combined tracer+profiling
`ddtrace.so` artifacts directly for PHP versions >= 20160303 (profiling is
built into the same `ddtrace.so` rather than a separate
`combined-ddtrace/`/`datadog-profiling/` tree); the script writes a
`.ddtrace[-zts|-debug].profiling` marker file per API version alongside
each `ddtrace.so` so `datadog-setup.php` can detect profiling support

Missing files cause hard `cp` failures. This means that we need to build (or
download from CI) all these individual artifacts. This is rarely desirable when
Expand Down
Loading
Loading