Skip to content

Commit 40bffac

Browse files
committed
Test all benchmarks now
1 parent 77336f9 commit 40bffac

4 files changed

Lines changed: 13 additions & 66 deletions

File tree

.gitlab-ci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,12 @@ include:
77
- project: 'DataDog/apm-reliability/apm-sdks-benchmarks'
88
file: '.gitlab/ci-java-spring-petclinic.yml'
99
ref: 'main'
10-
rules:
11-
- when: never # disable while testing merge base logic
1210
- project: 'DataDog/apm-reliability/apm-sdks-benchmarks'
1311
file: '.gitlab/ci-java-insecure-bank.yml'
1412
ref: 'main'
15-
rules:
16-
- when: never # disable while testing merge base logic
1713
- project: 'DataDog/apm-reliability/apm-sdks-benchmarks'
1814
file: '.gitlab/ci-java-dacapo.yml'
1915
ref: 'main'
20-
rules:
21-
- when: never # disable while testing merge base logic
2216

2317
stages:
2418
- build

.gitlab/benchmarks.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.dsm-kafka-benchmarks:
44
stage: benchmarks
55
rules:
6-
- when: never # disable while testing merge base logic
76
- if: '$POPULATE_CACHE'
87
when: never
98
- if: $CI_PIPELINE_SOURCE != "schedule"
@@ -48,7 +47,6 @@ dsm-kafka-consumer-benchmark:
4847
debugger-benchmarks:
4948
stage: benchmarks
5049
rules:
51-
- when: never # disable while testing merge base logic
5250
- if: '$POPULATE_CACHE'
5351
when: never
5452
- if: $CI_PIPELINE_SOURCE != "schedule"
@@ -89,7 +87,6 @@ debugger-benchmarks:
8987
tags: ["arch:amd64"]
9088
interruptible: true
9189
rules:
92-
- when: never # disable while testing merge base logic
9390
- if: '$POPULATE_CACHE'
9491
when: never
9592
- when: on_success
@@ -139,7 +136,6 @@ benchmarks-post-pr-comment:
139136
- job: benchmarks-compare-dacapo
140137
artifacts: true
141138
rules:
142-
- when: never # disable while testing merge base logic
143139
- if: '$POPULATE_CACHE'
144140
when: never
145141
- when: always
@@ -150,29 +146,3 @@ benchmarks-post-pr-comment:
150146
UPSTREAM_BRANCH: $CI_COMMIT_REF_NAME
151147
BP_HEADER: "Benchmarks"
152148
BP_ON_DUPLICATE: "replace"
153-
154-
# DEBUG MERGE BASE LOGIC IMMEDIATELY instead of waiting on all benchmarks to complete
155-
benchmarks-debug-baseline:
156-
stage: benchmark-comparison
157-
image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:6845f3c7
158-
tags: ["arch:amd64"]
159-
interruptible: true
160-
needs: []
161-
rules:
162-
- when: on_success
163-
script:
164-
- |
165-
if [ "$(uname -m)" = "x86_64" ]; then AAA="amd64"; else AAA="arm64"; fi
166-
wget -O /tmp/authanywhere "https://binaries.ddbuild.io/dd-source/authanywhere/LATEST/authanywhere-linux-${AAA}"
167-
chmod +x /tmp/authanywhere
168-
mv /tmp/authanywhere /usr/local/bin/authanywhere
169-
- mkdir -p reports/debug
170-
- .gitlab/scripts/get-baseline-commit-info.sh "reports/debug"
171-
- echo "Resolved baseline:"
172-
- cat reports/debug/baseline-info.env
173-
- if [[ -f "reports/debug/fallback_to_master.txt" ]]; then cat "reports/debug/fallback_to_master.txt"; fi
174-
artifacts:
175-
when: always
176-
paths:
177-
- reports/debug/
178-
expire_in: 1 week

.gitlab/scripts/benchmark-compare.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ list_matching_jobs() {
7070
curl --silent --show-error --fail \
7171
--header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
7272
"${JOBS_API_URL}/pipelines/${pipeline_id}/jobs?scope[]=success&per_page=100" \
73-
| python3 - "${pattern}" <<'PY'
73+
| python3 -c '
7474
import json
7575
import re
7676
import sys
@@ -82,8 +82,8 @@ for job in jobs:
8282
continue
8383
if not job.get("artifacts_file") or not job["artifacts_file"].get("filename"):
8484
continue
85-
print(f'{job["id"]}|{job["name"]}')
86-
PY
85+
print("{}|{}".format(job["id"], job["name"]))
86+
' "${pattern}"
8787
}
8888

8989
download_job_artifacts() {
@@ -249,6 +249,11 @@ convert_dacapo_job() {
249249
local source_dir="$1"
250250
local side="$2"
251251
local variant="$3"
252+
local dacapo_root="${source_dir}/dacapo"
253+
254+
if [[ ! -d "${dacapo_root}" ]]; then
255+
return
256+
fi
252257

253258
while IFS= read -r benchmark_dir; do
254259
local benchmark_name
@@ -264,7 +269,7 @@ convert_dacapo_job() {
264269
"${benchmark_dir}"
265270

266271
post_process_dacapo "${out_file}" "${benchmark_name}" "${variant}" "${side}"
267-
done < <(find "${source_dir}" -type d -path '*/dacapo/*/*')
272+
done < <(find "${dacapo_root}" -mindepth 2 -maxdepth 2 -type d)
268273
}
269274

270275
convert_load_job() {
@@ -287,7 +292,7 @@ convert_load_job() {
287292
mkdir -p "${target_dir}"
288293

289294
benchmark_analyzer merge \
290-
--mergeby="['scenario', 'application', 'variant', 'baseline_or_candidate', 'git_branch', 'git_commit_sha', 'git_commit_date', 'cpu_model', 'kernel_version', 'ci_job_date', 'ci_job_id', 'ci_pipeline_id']" \
295+
--mergeby="['scenario', 'application', 'variant', 'baseline_or_candidate', 'git_branch', 'git_commit_sha', 'git_commit_date', 'cpu_model', 'kernel_version']" \
291296
--outpath="${out_file}" \
292297
"${k6_files[@]}"
293298

.gitlab/scripts/get-baseline-commit-info.sh

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ fi
1919
readonly PROJECT_API_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}"
2020
readonly BTI_TOKEN_URL="https://bti-ci-api.us1.ddbuild.io/internal/ci/gitlab/token?owner=DataDog&repository=apm-reliability/dd-trace-java"
2121

22-
log_debug() {
23-
echo "[baseline-debug] $*" >&2
24-
}
25-
26-
response_snippet() {
27-
local response="$1"
28-
echo "${response}" | tr '\n' ' ' | sed 's/[[:space:]]\+/ /g' | cut -c1-220
29-
}
30-
3122
get_private_token() {
3223
local auth_header bti_response http_status response_body private_token
3324

@@ -45,7 +36,7 @@ get_private_token() {
4536
response_body="$(echo "${bti_response}" | sed '/HTTP_STATUS:/d')"
4637

4738
if [[ "${http_status}" != "200" ]]; then
48-
echo "BTI token request failed: status=${http_status}, body='$(response_snippet "${response_body}")'" >&2
39+
echo "BTI token request failed with status ${http_status}." >&2
4940
return 1
5041
fi
5142

@@ -63,17 +54,14 @@ get_pipeline_id_for_commit() {
6354
local api_url="${PROJECT_API_URL}/repository/commits/${commit_sha}"
6455
local response pipeline_id private_token
6556

66-
log_debug "query commit endpoint: ${api_url}"
6757
private_token="$(get_private_token)" || return 1
6858
response="$(curl --request GET --silent --show-error --header "PRIVATE-TOKEN: ${private_token}" "${api_url}" || true)"
6959
pipeline_id="$(echo "${response}" | grep -o '"last_pipeline"[^}]*"id":[0-9]*' | grep -o '[0-9]*$' | head -1 || true)"
7060
if [[ -n "${pipeline_id}" && "${pipeline_id}" != "null" ]]; then
71-
log_debug "found pipeline_id=${pipeline_id} for commit_sha=${commit_sha}"
72-
echo "${pipeline_id}"
61+
echo "Pipeline ID for commit ${commit_sha}: ${pipeline_id}"
7362
return 0
7463
fi
7564

76-
log_debug "no last_pipeline.id for commit_sha=${commit_sha}; response='$(response_snippet "${response}")'"
7765
return 1
7866
}
7967

@@ -82,16 +70,10 @@ get_latest_pipeline_id_for_branch() {
8270
local api_url="${PROJECT_API_URL}/pipelines?ref=${branch}&order_by=id&sort=desc&per_page=1"
8371
local response pipeline_id private_token
8472

85-
log_debug "query pipelines endpoint: ${api_url}"
8673
private_token="$(get_private_token)" || return 1
8774
response="$(curl --request GET --silent --show-error --header "PRIVATE-TOKEN: ${private_token}" "${api_url}" || true)"
8875
pipeline_id="$(echo "${response}" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*' || true)"
89-
if [[ -n "${pipeline_id}" ]]; then
90-
log_debug "found latest pipeline_id=${pipeline_id} for branch=${branch}"
91-
else
92-
log_debug "no pipeline found for branch=${branch}; response='$(response_snippet "${response}")'"
93-
fi
94-
echo "${pipeline_id}"
76+
echo "Pipeline ID for branch ${branch}: ${pipeline_id}"
9577
}
9678

9779
resolve_merge_base_sha() {
@@ -110,19 +92,15 @@ BASELINE_PIPELINE_ID=""
11092
BASELINE_SOURCE="merge_base"
11193
FALLBACK_TO_MASTER="false"
11294

113-
log_debug "resolved merge_base_sha='${MERGE_BASE_SHA:-<empty>}' target_branch='${TARGET_BRANCH}'"
114-
11595
if [[ -n "${MERGE_BASE_SHA}" ]]; then
11696
BASELINE_PIPELINE_ID="$(get_pipeline_id_for_commit "${MERGE_BASE_SHA}" || true)"
11797
fi
11898

11999
if [[ -z "${BASELINE_PIPELINE_ID}" ]]; then
120100
FALLBACK_TO_MASTER="true"
121101
BASELINE_SOURCE="${TARGET_BRANCH}"
122-
log_debug "merge-base pipeline not found; falling back to branch='${TARGET_BRANCH}'"
123102

124103
BASELINE_SHA="$(git rev-parse "origin/${TARGET_BRANCH}" 2>/dev/null || true)"
125-
log_debug "resolved branch sha from local git: '${BASELINE_SHA:-<empty>}'"
126104
if [[ -n "${BASELINE_SHA}" ]]; then
127105
BASELINE_PIPELINE_ID="$(get_pipeline_id_for_commit "${BASELINE_SHA}" || true)"
128106
fi

0 commit comments

Comments
 (0)