Skip to content

Commit 4a95542

Browse files
authored
Merge branch 'main' into m/confra-endpt
2 parents 87a4225 + 0dee0a9 commit 4a95542

79 files changed

Lines changed: 1312469 additions & 206 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.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dhat-heap.json
1010
.DS_Store
1111
dist/
1212
checks_venv/
13+
.venv/
1314
# JavaScript-y things related to documentation generation.
1415
yarn.lock
1516
/.vitepress/

.gitlab/benchmark.yml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,30 @@
88
- export SMP_ECR_HOST="${SMP_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com"
99
- export ADP_IMG_BASE="${SMP_ECR_HOST}/${SMP_TEAM_ID}-saluki:adp-${CI_PIPELINE_ID}"
1010
- export ADP_CHECKS_IMG_BASE="${SMP_ECR_HOST}/${SMP_TEAM_ID}-saluki:adp-checks-${CI_PIPELINE_ID}"
11+
- export SMP_IMG_BASE="${SMP_ECR_HOST}/${SMP_TEAM_ID}-saluki:agent-adp-${CI_PIPELINE_ID}"
1112
- git fetch --verbose --deepen=999 origin ${CI_COMMIT_BRANCH} main
1213

14+
# Layer the ADP image at ${ADP_IMG} into the converged Datadog Agent image and push it as
15+
# ${SMP_IMG}. Both the baseline and comparison build jobs end with this.
16+
#
17+
# SMP fixes one target image per job, and the tag filtering experiments need the Core Agent in the
18+
# picture: a `metric_tag_filterlist` is Agent configuration, and only reaches ADP over the config
19+
# stream. So every experiment runs against the converged image; the ones that don't care about the
20+
# Core Agent simply override the command to run ADP by itself, as they always have.
21+
.build-smp-target-image: &build-smp-target-image
22+
- docker buildx build
23+
--file ./docker/Dockerfile.datadog-agent
24+
--tag ${SMP_IMG}
25+
--build-arg DD_AGENT_IMAGE=registry.datadoghq.com/agent:${PUBLIC_DD_AGENT_VERSION}
26+
--build-arg ADP_IMAGE=${ADP_IMG}
27+
--label git.repository=${CI_PROJECT_NAME}
28+
--label git.branch=${CI_COMMIT_REF_NAME}
29+
--label git.commit=${CI_COMMIT_SHA}
30+
--label ci.pipeline_id=${CI_PIPELINE_ID}
31+
--label ci.job_id=${CI_JOB_ID}
32+
--push
33+
.
34+
1335
build-adp-baseline-image:
1436
extends: .build-common-variables
1537
stage: benchmark
@@ -50,17 +72,22 @@ build-adp-baseline-image:
5072
--build-arg SPDX_LICENSES_IMAGE=${SPDX_LICENSES_IMAGE}
5173
--build-arg APP_IMAGE=${GBI_BASE_IMAGE}
5274
--build-arg APP_GIT_HASH=${BASELINE_ADP_SHA}
53-
--build-arg INTERNAL_BUILD=true
5475
--label git.repository=${CI_PROJECT_NAME}
5576
--label git.branch=${CI_COMMIT_REF_NAME}
5677
--label git.commit=${CI_COMMIT_SHA}
5778
--label ci.pipeline_id=${CI_PIPELINE_ID}
5879
--label ci.job_id=${CI_JOB_ID}
5980
--push
6081
.
82+
# Bundle that ADP build into the converged Datadog Agent image, which is the image SMP
83+
# actually runs.
84+
- export ADP_IMG="${BASELINE_ADP_IMG}"
85+
- export SMP_IMG="${SMP_IMG_BASE}-${BASELINE_ADP_SHA}"
86+
- *build-smp-target-image
6187
# Generate our image SHA/path for the runner job to use.
6288
- echo "BASELINE_ADP_SHA=${BASELINE_ADP_SHA}" >> smp-vars.env
6389
- echo "BASELINE_ADP_IMG=${BASELINE_ADP_IMG}" >> smp-vars.env
90+
- echo "BASELINE_SMP_IMG=${SMP_IMG}" >> smp-vars.env
6491
artifacts:
6592
reports:
6693
dotenv: smp-vars.env
@@ -102,17 +129,22 @@ build-adp-comparison-image:
102129
--build-arg SPDX_LICENSES_IMAGE=${SPDX_LICENSES_IMAGE}
103130
--build-arg APP_IMAGE=${GBI_BASE_IMAGE}
104131
--build-arg APP_GIT_HASH=${COMPARISON_ADP_SHA}
105-
--build-arg INTERNAL_BUILD=true
106132
--label git.repository=${CI_PROJECT_NAME}
107133
--label git.branch=${CI_COMMIT_REF_NAME}
108134
--label git.commit=${CI_COMMIT_SHA}
109135
--label ci.pipeline_id=${CI_PIPELINE_ID}
110136
--label ci.job_id=${CI_JOB_ID}
111137
--push
112138
.
139+
# Bundle that ADP build into the converged Datadog Agent image, which is the image SMP
140+
# actually runs.
141+
- export ADP_IMG="${COMPARISON_ADP_IMG}"
142+
- export SMP_IMG="${SMP_IMG_BASE}-${COMPARISON_ADP_SHA}"
143+
- *build-smp-target-image
113144
# Generate our image SHA/path for the runner job to use.
114145
- echo "COMPARISON_ADP_SHA=${COMPARISON_ADP_SHA}" >> smp-vars.env
115146
- echo "COMPARISON_ADP_IMG=${COMPARISON_ADP_IMG}" >> smp-vars.env
147+
- echo "COMPARISON_SMP_IMG=${SMP_IMG}" >> smp-vars.env
116148
artifacts:
117149
reports:
118150
dotenv: smp-vars.env
@@ -149,8 +181,8 @@ run-benchmarks-adp:
149181
- ./smp --team-id ${SMP_TEAM_ID} --aws-named-profile ${AWS_NAMED_PROFILE}
150182
job submit
151183
--warmup-seconds 0
152-
--baseline-image ${BASELINE_ADP_IMG}
153-
--comparison-image ${COMPARISON_ADP_IMG}
184+
--baseline-image ${BASELINE_SMP_IMG}
185+
--comparison-image ${COMPARISON_SMP_IMG}
154186
--baseline-sha ${BASELINE_ADP_SHA}
155187
--comparison-sha ${COMPARISON_ADP_SHA}
156188
--target-config-dir ./test/smp/regression/adp/quality-gates/
@@ -241,8 +273,8 @@ run-benchmarks-adp-full:
241273
- ./smp --team-id ${SMP_TEAM_ID} --aws-named-profile ${AWS_NAMED_PROFILE}
242274
job submit
243275
--warmup-seconds 0
244-
--baseline-image ${BASELINE_ADP_IMG}
245-
--comparison-image ${COMPARISON_ADP_IMG}
276+
--baseline-image ${BASELINE_SMP_IMG}
277+
--comparison-image ${COMPARISON_SMP_IMG}
246278
--baseline-sha ${BASELINE_ADP_SHA}
247279
--comparison-sha ${COMPARISON_ADP_SHA}
248280
--target-config-dir ./test/smp/regression/adp/full/

Makefile

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ build-adp-image-base:
171171
--build-arg "APP_IDENTIFIER=$(ADP_APP_IDENTIFIER)" \
172172
--build-arg "APP_VERSION=$(ADP_APP_VERSION)" \
173173
--build-arg "APP_GIT_HASH=$(ADP_APP_GIT_HASH)" \
174-
--build-arg "INTERNAL_BUILD=true" \
175174
--file ./docker/Dockerfile.agent-data-plane \
176175
.
177176

@@ -842,15 +841,17 @@ endif
842841
--inlined-functions true --timeline --upload-period 10 --preset cpu_live_heap \
843842
target/release/agent-data-plane run
844843

844+
SMP_GENERATOR := test/smp/regression/adp/generate_experiments.py
845+
845846
.PHONY: generate-smp-experiments
846847
generate-smp-experiments: ## Generates SMP experiment configs from experiments.yaml
847848
@echo "[*] Generating SMP experiment configurations..."
848-
@python3 test/smp/regression/adp/generate_experiments.py
849+
@$(PYTHON) $(SMP_GENERATOR)
849850

850851
.PHONY: check-smp-experiments
851852
check-smp-experiments: ## Verifies SMP experiment configs are up-to-date (CI)
852853
@echo "[*] Checking SMP experiment configurations..."
853-
@python3 test/smp/regression/adp/generate_experiments.py --check
854+
@$(PYTHON) $(SMP_GENERATOR) --check
854855

855856
.PHONY: profile-run-smp-experiment
856857
profile-run-smp-experiment: ## Runs a specific SMP experiment for Saluki
@@ -925,6 +926,28 @@ run-docs: ## Runs a local development server for documentation
925926

926927
##@ Utility
927928

929+
# Interpreter used by targets that run our Python tooling: the local virtualenv when there is one,
930+
# otherwise whatever `python3` resolves to. That keeps local development on the pinned versions in
931+
# requirements.txt -- some of these scripts generate committed files that CI compares
932+
# byte-for-byte -- without making the virtualenv mandatory, since CI's build image pre-installs
933+
# the same requirements system-wide.
934+
#
935+
# Deliberately recursive (`=`, not `:=`) so the choice is made when a recipe runs rather than when
936+
# the makefile is parsed, and `make ensure-python-venv generate-smp-experiments` works in one go.
937+
# There is no separate "activate the virtualenv" target because make gives every recipe line its
938+
# own shell; naming the interpreter is the equivalent, and activation does nothing more than put
939+
# this same binary first on PATH.
940+
VENV_DIR := .venv
941+
VENV_PYTHON := $(VENV_DIR)/bin/python
942+
PYTHON_REQUIREMENTS := requirements.txt
943+
PYTHON = $(if $(wildcard $(VENV_PYTHON)),$(VENV_PYTHON),python3)
944+
945+
.PHONY: ensure-python-venv
946+
ensure-python-venv: ## Creates the virtualenv that Python tooling prefers, or updates an existing one
947+
@echo "[*] Installing Python tooling dependencies into $(VENV_DIR)..."
948+
@python3 -m venv $(VENV_DIR)
949+
@$(VENV_PYTHON) -m pip install --quiet --disable-pip-version-check --requirement $(PYTHON_REQUIREMENTS)
950+
928951
.PHONY: update-protos
929952
update-protos: ## Updates all vendored Protocol Buffers definitions from their source repositories
930953
@DD_AGENT_GIT_TAG=$(PROTOBUF_SRC_REPO_DD_AGENT) \

ci/images/definitions/build/Dockerfile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,26 @@ RUN --mount=type=bind,from=ci-scripts,target=/scripts \
3939
apt-get update && \
4040
apt-get install -y --no-install-recommends \
4141
build-essential software-properties-common curl ca-certificates git gnupg2 \
42-
lsb-release make cmake unzip gcc g++ binutils jq bc bzip2 ninja-build python3 python3-pip python3-yaml && \
42+
lsb-release make cmake unzip gcc g++ binutils jq bc bzip2 ninja-build python3 python3-pip \
43+
python3-venv && \
44+
/scripts/clean-temporary-caches.sh
45+
46+
# Pre-install the Python dependencies our tooling needs (requirements.txt), so jobs don't pay to
47+
# download them on every run. They go to the system interpreter, which is what the Makefile falls
48+
# back to when there is no local virtualenv, and the versions stay pinned to the same file
49+
# developers install from.
50+
#
51+
# Two flags earn their place here:
52+
#
53+
# - `--break-system-packages`, because the Ubuntu base marks its interpreter as externally
54+
# managed. In a single-purpose CI image that is exactly what we want.
55+
# - `--ignore-installed`, because the base ships some of these as dpkg packages (PyYAML, today).
56+
# pip cannot uninstall those -- they have no RECORD file -- and fails the build rather than
57+
# upgrading them. This skips the removal and installs our pinned versions alongside, into
58+
# /usr/local/lib, which precedes the distro's dist-packages on `sys.path` and so wins at import.
59+
RUN --mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt \
60+
--mount=type=bind,from=ci-scripts,target=/scripts \
61+
pip3 install --break-system-packages --ignore-installed --requirement /tmp/requirements.txt && \
4362
/scripts/clean-temporary-caches.sh
4463

4564
# Install the Docker CLI directly, as well as the CI-specific credential helper.

ci/tooling/maybe-profile.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

docker/Dockerfile.agent-data-plane

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ ARG APP_GIT_HASH=""
5454
ARG APP_VERSION=""
5555
ARG APP_BUILD_TIME=""
5656
ARG DD_AGENT_VERSION=""
57-
ARG INTERNAL_BUILD=""
5857
ARG BUILDCACHE_REMOTE=
5958
ARG BUILDCACHE_DEBUG=
6059

@@ -100,12 +99,8 @@ RUN --mount=type=bind,source=docker/scripts,target=/scripts \
10099
# and so on.
101100
FROM ${BUILD_IMAGE} AS final-prep
102101

103-
ARG TARGETARCH
104-
ARG INTERNAL_BUILD=""
105102
ARG SPDX_LICENSES_VERSION=3.28.0
106103
ENV BUILD_ROOT=/rootfs
107-
ENV TARGETARCH=${TARGETARCH}
108-
ENV INTERNAL_BUILD=${INTERNAL_BUILD}
109104
ENV SPDX_LICENSES_VERSION=${SPDX_LICENSES_VERSION}
110105

111106
RUN --mount=type=bind,source=docker/scripts,target=/scripts \

docker/scripts/agent-data-plane/final-prep/10-install-profiling.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

requirements.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Python dependencies for this repository's tooling.
2+
#
3+
# `make ensure-python-venv` installs these into a local virtualenv, which the targets that run
4+
# Python scripts prefer over the system interpreter. CI's build image pre-installs this same file
5+
# system-wide instead, so its jobs don't download anything at run time.
6+
#
7+
# Versions are pinned because some of that tooling generates committed files that CI compares
8+
# byte-for-byte (see test/smp/regression/adp/generate_experiments.py): an unpinned YAML emitter or
9+
# template engine could reformat its output and fail a check for reasons that have nothing to do
10+
# with the change under review.
11+
Jinja2==3.1.6
12+
PyYAML==6.0.3

0 commit comments

Comments
 (0)