Skip to content

Commit 275f935

Browse files
authored
Merge branch 'master' into vpellan/otel-threshold-random-value
2 parents ff73862 + 5fe256c commit 275f935

102 files changed

Lines changed: 1695 additions & 373 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitlab/benchmarks.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ include:
2222
when: on_success
2323
interruptible: false
2424

25+
# Benchmark jobs run on dedicated bare-metal/same-cpu runners; retry the
26+
# infrastructure-level failures so a flaky runner doesn't fail the pipeline.
27+
.benchmarks-retry: &benchmarks-retry
28+
max: 2
29+
when:
30+
- unknown_failure
31+
- data_integrity_failure
32+
- runner_system_failure
33+
- scheduler_failure
34+
- api_failure
35+
2536
.macrobenchmarks-rules: &macrobenchmarks-rules
2637
- <<: *on-master-and-parent-pipeline-source-pipeline-on-success-and-not-interruptible
2738
- <<: *on-master-or-nightly-benchmarks-or-release-on-success-and-not-interruptible
@@ -30,6 +41,7 @@ include:
3041
interruptible: true
3142

3243
linux-php-laravel-realworld-parallel:
44+
retry: *benchmarks-retry
3345
needs:
3446
- job: "package extension (bundles): [amd64, x86_64-unknown-linux-gnu]"
3547
artifacts: true
@@ -40,6 +52,7 @@ linux-php-laravel-realworld-parallel:
4052
DD_TRACER_ARTIFACT_DIR: "$CI_PROJECT_DIR/packages"
4153

4254
linux-php-symfony-realworld-parallel:
55+
retry: *benchmarks-retry
4356
needs:
4457
- job: "package extension (bundles): [amd64, x86_64-unknown-linux-gnu]"
4558
artifacts: true
@@ -50,6 +63,7 @@ linux-php-symfony-realworld-parallel:
5063
DD_TRACER_ARTIFACT_DIR: "$CI_PROJECT_DIR/packages"
5164

5265
linux-php-wordpress-parallel:
66+
retry: *benchmarks-retry
5367
needs:
5468
- job: "package extension (bundles): [amd64, x86_64-unknown-linux-gnu]"
5569
artifacts: true
@@ -149,6 +163,7 @@ workflow:
149163

150164
.microbenchmarks:
151165
stage: benchmarks
166+
retry: *benchmarks-retry
152167
tags: ["runner:apm-k8s-tweaked-metal"]
153168
needs: []
154169
image:
@@ -248,6 +263,7 @@ check-big-regressions:
248263

249264
.macrobenchmarks:
250265
stage: benchmarks
266+
retry: *benchmarks-retry
251267
needs:
252268
- job: "package extension (bundles): [amd64, x86_64-unknown-linux-gnu]"
253269
artifacts: true

‎.gitlab/build-loader.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,13 @@ phpize
2222
./configure
2323
make clean
2424
make -j "${MAKE_JOBS}" all ECHO_ARG="-e" CFLAGS="-std=gnu11 -O2 -g -Wall -Wextra -Werror -DPHP_DD_LIBRARY_LOADER_VERSION='\"$(cat ../VERSION)\"'"
25+
26+
# The reaper is copied out of the loader. Reject accidental references to its
27+
# code/data, including compiler instrumentation, before packaging the library.
28+
REAPER_RELOCATIONS="$(LC_ALL=C objdump -r -j ddloader_reaper_code .libs/telemetry_reaper.o)"
29+
if [[ "${REAPER_RELOCATIONS}" == *"RELOCATION RECORDS"* ]]; then
30+
printf 'Telemetry reaper must not contain relocations:\n%s\n' "${REAPER_RELOCATIONS}"
31+
exit 1
32+
fi
33+
2534
cp modules/dd_library_loader.so "../dd_library_loader-$(uname -m)-${HOST_OS}.so"

‎.gitlab/build-tracing-asan.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mkdir -p extensions_$(uname -m)
77

88
# Build extension basic .so
99
switch-php "debug-zts-asan"
10-
make RUST_DEBUG_BUILD=1
10+
.gitlab/run-with-retryable-download.sh make RUST_DEBUG_BUILD=1
1111
cp -v "tmp/build_extension/modules/ddtrace.so" "extensions_$(uname -m)/ddtrace-${ABI_NO}-debug-zts.so"
1212

1313
# Compress debug info

‎.gitlab/compile_extension.sh‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,30 @@ if [ "${WITH_ASAN}" -eq "1" ]; then
2020
export COMPILE_ASAN=1
2121
fi
2222
# Compile Rust and PHP in parallel
23-
SHARED=1 ./compile_rust.sh &
23+
rust_build_log=$(mktemp)
24+
trap 'rm -f "$rust_build_log"' EXIT
25+
SHARED=1 ./compile_rust.sh 2>&1 | tee "$rust_build_log" &
26+
rust_build_pid=$!
2427
make -j static &
25-
wait
28+
c_build_pid=$!
29+
30+
# A bare wait discards the exit statuses of both background builds.
31+
rust_build_status=0
32+
c_build_status=0
33+
wait "$rust_build_pid" || rust_build_status=$?
34+
wait "$c_build_pid" || c_build_status=$?
35+
if [ "$c_build_status" -ne 0 ]; then
36+
exit "$c_build_status"
37+
fi
38+
if [ "$rust_build_status" -ne 0 ]; then
39+
# Retry the job with a clean target directory: libddwaf may have left a
40+
# partially extracted archive, which cannot safely be reused locally.
41+
if grep -Eq 'Failed to (download archive|write archive entry contents to file):.*reqwest::Error.*(ConnectionReset|ConnectionAborted|TimedOut|IncompleteMessage|UnexpectedEof)' "$rust_build_log"; then
42+
echo "Transient libddwaf download failure; exiting 75 for GitLab retry." >&2
43+
exit 75
44+
fi
45+
exit "$rust_build_status"
46+
fi
2647

2748
# Link extension
2849
cc -shared -Wl,-whole-archive "${MODULES_DIR}/ddtrace.a" \
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$root = Split-Path $PSScriptRoot -Parent
4+
$dumpFolder = Join-Path $root 'dumps'
5+
New-Item -ItemType Directory -Path $dumpFolder -Force | Out-Null
6+
7+
$wer = 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting'
8+
$localDumps = Join-Path $wer 'LocalDumps\php.exe'
9+
New-Item -Path $localDumps -Force | Out-Null
10+
New-ItemProperty -Path $localDumps -Name DumpFolder -Value $dumpFolder -PropertyType ExpandString -Force | Out-Null
11+
New-ItemProperty -Path $localDumps -Name DumpType -Value 2 -PropertyType DWord -Force | Out-Null
12+
New-ItemProperty -Path $localDumps -Name DumpCount -Value 10 -PropertyType DWord -Force | Out-Null
13+
New-ItemProperty -Path $wer -Name DontShowUI -Value 1 -PropertyType DWord -Force | Out-Null
14+
15+
# proc_open's suppress_errors sets SEM_NOGPFAULTERRORBOX in the child, which
16+
# disables WER. Keep WER enabled for every test's FILE process.
17+
$runner = Join-Path $root 'run-tests.php'
18+
$source = [IO.File]::ReadAllText($runner)
19+
$pattern = "'suppress_errors'\s*=>\s*true"
20+
if ([regex]::Matches($source, $pattern).Count -ne 1) {
21+
throw "Expected one proc_open suppress_errors option in $runner"
22+
}
23+
$replacement = "'suppress_errors' => false"
24+
$source = [regex]::Replace($source, $pattern, [System.Text.RegularExpressions.MatchEvaluator]{ param($match) $replacement })
25+
[IO.File]::WriteAllText($runner, $source, (New-Object System.Text.UTF8Encoding($false)))

‎.gitlab/generate-appsec.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
image: registry.ddbuild.io/agent-delivery/dd-pkg:v0.9.3
9797
tags: [ "arch:arm64" ]
9898
variables:
99-
IMG_REGISTRIES: "dockerhub"
99+
IMG_REGISTRIES: "dev"
100100
IMG_SIGNING: "false"
101101
PUBLIC_IMAGES_PUBLISH_TIMEOUT: "1800"
102102
script:
@@ -182,7 +182,8 @@
182182
<?php echo $ecrLoginSnippet, "\n"; ?>
183183
<?php dockerhub_login() ?>
184184
script:
185-
- apt update && apt install -y openjdk-17-jre
185+
- .gitlab/run-with-retryable-download.sh apt update
186+
- .gitlab/run-with-retryable-download.sh apt install -y openjdk-17-jre
186187
- find "$CI_PROJECT_DIR"/appsec/tests/integration/build || true
187188
- |
188189
cd appsec/tests/integration
@@ -467,6 +468,7 @@
467468
- ARCH: ["amd64", "arm64"]
468469
rules:
469470
- when: manual
471+
allow_failure: true
470472
needs: []
471473
artifacts:
472474
when: on_failure

‎.gitlab/generate-common.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function windows_git_setup_with_packages() {
227227
KUBERNETES_SERVICE_MEMORY_LIMIT: 512Mi
228228

229229
request-replayer:
230-
name: registry.ddbuild.io/ci/dd-trace-php/request-replayer:3.0
230+
name: registry.ddbuild.io/ci/dd-trace-php/request-replayer:4.0
231231
alias: request-replayer
232232
command: ["php", "-S", "<?= $service_bind_address ?>:80", "index.php"]
233233
variables:

‎.gitlab/generate-package.php‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,9 +968,16 @@ function package_extension_jobs(array $platform, string $kind = "all"): array
968968
artifacts: true
969969
- job: "package extension (bundles): [arm64, aarch64-unknown-linux-gnu]"
970970
artifacts: true
971+
- job: "package extension: [amd64, x86_64-alpine-linux-musl]"
972+
artifacts: true
973+
- job: "package extension: [arm64, aarch64-alpine-linux-musl]"
974+
artifacts: true
971975
- job: datadog-setup.php
972976
artifacts: true
973977
variables:
978+
INSTALLER_ARTIFACT_SERVER: installer-artifacts
979+
INSTALLER_DOCKER_NETWORK: installer-tests
980+
INSTALLER_REPOSITORY_URL: http://installer-artifacts
974981
KUBERNETES_CPU_REQUEST: 2
975982
KUBERNETES_MEMORY_REQUEST: 2Gi
976983
KUBERNETES_MEMORY_LIMIT: 4Gi
@@ -981,8 +988,50 @@ function package_extension_jobs(array $platform, string $kind = "all"): array
981988
- apt install -y make
982989
- mkdir build
983990
- mv packages build
991+
- |
992+
set -- build/packages/dd-library-php-*-x86_64-linux-gnu.tar.gz
993+
if [ "$#" -ne 1 ] || [ ! -f "$1" ]; then
994+
echo "Expected exactly one full x86_64 GNU bundle, found: $*"
995+
exit 1
996+
fi
997+
version=${1#build/packages/dd-library-php-}
998+
version=${version%-x86_64-linux-gnu.tar.gz}
999+
printf '%s\n' "$version" > VERSION
1000+
for platform in \
1001+
x86_64-linux-gnu \
1002+
aarch64-linux-gnu \
1003+
x86_64-linux-musl \
1004+
aarch64-linux-musl; do
1005+
bundle="build/packages/dd-library-php-${version}-${platform}.tar.gz"
1006+
if [ ! -f "$bundle" ]; then
1007+
echo "Missing installer bundle: $bundle"
1008+
exit 1
1009+
fi
1010+
done
1011+
- docker network create "$INSTALLER_DOCKER_NETWORK"
1012+
- |
1013+
docker run --detach --rm \
1014+
--name "$INSTALLER_ARTIFACT_SERVER" \
1015+
--network "$INSTALLER_DOCKER_NETWORK" \
1016+
--volume "$CI_PROJECT_DIR/build/packages:/usr/share/nginx/html/releases/download/$(<VERSION):ro" \
1017+
nginx:1.27-alpine
1018+
- |
1019+
for attempt in $(seq 1 10); do
1020+
if docker exec "$INSTALLER_ARTIFACT_SERVER" wget --quiet --spider \
1021+
"http://127.0.0.1/releases/download/$(<VERSION)/datadog-setup.php"; then
1022+
break
1023+
fi
1024+
if [ "$attempt" -eq 10 ]; then
1025+
docker logs "$INSTALLER_ARTIFACT_SERVER"
1026+
exit 1
1027+
fi
1028+
sleep 1
1029+
done
9841030
script:
9851031
- make -C dockerfiles/verify_packages test_installer
1032+
after_script:
1033+
- docker rm --force "$INSTALLER_ARTIFACT_SERVER" || true
1034+
- docker network rm "$INSTALLER_DOCKER_NETWORK" || true
9861035

9871036
"test early PHP 8.1":
9881037
stage: verify
@@ -1319,6 +1368,8 @@ function package_extension_jobs(array $platform, string $kind = "all"): array
13191368
DDAGENT_HOSTNAME: 127.0.0.1
13201369
DD_AGENT_HOST: 127.0.0.1
13211370
DATADOG_HAVE_DEV_ENV: 1
1371+
_DD_DEBUG_SIDECAR_LOG_LEVEL: trace
1372+
_DD_DEBUG_SIDECAR_LOG_METHOD: "file://${CI_PROJECT_DIR}/artifacts/sidecar.log"
13221373
needs:
13231374
- job: "package extension (installers): [amd64, x86_64-unknown-linux-gnu]"
13241375
artifacts: true
@@ -1327,6 +1378,7 @@ function package_extension_jobs(array $platform, string $kind = "all"): array
13271378
- !reference [.services, httpbin-integration]
13281379
before_script:
13291380
<?php dockerhub_login() ?>
1381+
- mkdir -p artifacts
13301382
- switch-php debug
13311383
script:
13321384
- sudo dpkg -i packages/*amd64*.deb

‎.gitlab/generate-profiler.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
- php -v
162162
# Fail loudly if the profiler did not load: otherwise the language tests
163163
# would run profiler-less and pass, giving a false green.
164-
- php -m | grep -qx 'datadog-profiling' || { echo 'ERROR datadog-profiling extension is not loaded'; exit 1; }
164+
- php -r 'exit((int) !extension_loaded("datadog-profiling"));' || { echo 'ERROR datadog-profiling extension is not loaded'; exit 1; }
165165
- cat "${XFAIL_LIST}" profiling/tests/php-language-xfail.list > /tmp/profiler-php-language-xfail.list
166166
- "if php -r 'exit(PHP_VERSION_ID < 80400 ? 0 : 1);'; then cat profiling/tests/php-language-xfail-pre84.list >> /tmp/profiler-php-language-xfail.list; fi"
167167
- export XFAIL_LIST=/tmp/profiler-php-language-xfail.list

‎.gitlab/generate-shared.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
- switch-php "<?= $switch_php_version ?>"
184184
- mkdir -p tmp/build_zai && cd tmp/build_zai
185185
- CMAKE_PREFIX_PATH=/opt/catch2 Tea_ROOT=../../tmp/tea/<?= $switch_php_version ?> cmake <?= $toolchain ?> -DCMAKE_BUILD_TYPE=Debug -DBUILD_ZAI_TESTING=ON -DPhpConfig_ROOT=$(php-config --prefix) ../../zend_abstract_interface
186-
- make -j all
186+
- ../../.gitlab/run-with-retryable-download.sh make -j all
187187
- mkdir -p "${CI_PROJECT_DIR}/artifacts"
188188
- make test ARGS="--output-junit ${CI_PROJECT_DIR}/artifacts/zai-<?= $major_minor ?>-<?= $switch_php_version ?>-results.xml --output-on-failure"
189189
- grep -e "=== Total [0-9]+ memory leaks detected ===" Testing/Temporary/LastTest.log && exit 1 || true
@@ -213,7 +213,7 @@
213213
- echo "extension=curl.so" | sudo tee $(php -i | awk -F"=> " '/Scan this dir for additional .ini files/ {print $2}')/curl.ini
214214
- mkdir -p tmp/build_zai && cd tmp/build_zai
215215
- CMAKE_PREFIX_PATH=/opt/catch2 Tea_ROOT=../../tmp/tea/nts cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_ZAI_TESTING=ON -DRUN_SHARED_EXTS_TESTS=1 -DPhpConfig_ROOT=$(php-config --prefix) ../../zend_abstract_interface
216-
- make -j all
216+
- ../../.gitlab/run-with-retryable-download.sh make -j all
217217
- TEA_INI_IGNORE=0 make test
218218
- grep -e "=== Total [0-9]+ memory leaks detected ===" Testing/Temporary/LastTest.log && exit 1 || true
219219
<?php
@@ -240,7 +240,7 @@
240240
artifacts: true
241241
script:
242242
- switch-php "<?= $switch_php_version ?>"
243-
- make install # build ddtrace.so
243+
- .gitlab/run-with-retryable-download.sh make install # build ddtrace.so
244244
- mkdir -p tmp/build_ext-tea && cd tmp/build_ext-tea
245245
- CMAKE_PREFIX_PATH=/opt/catch2 Tea_ROOT=../../tmp/tea/<?= $switch_php_version ?> cmake <?= $toolchain ?> -DCMAKE_BUILD_TYPE=Debug -S ../../tests/tea
246246
- cmake --build . --parallel

0 commit comments

Comments
 (0)