Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Check Support #277

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0a1c735
Squashed previous work for simpler rebase
scottopell Oct 16, 2024
e89505a
Addresses remaining build errors
scottopell Oct 21, 2024
8565559
Adds getting-started make action and readme notes for python checks
scottopell Oct 21, 2024
0024157
An attempt to get modern cpython installed in build-image
scottopell Oct 21, 2024
84e6bb4
Updates (all?) images to copy in libs from dd-agent image
scottopell Oct 22, 2024
4c54c58
Add embedded files into adp image and move embedded-copy later in the…
scottopell Oct 22, 2024
5cc8bf9
Use upgraded base images that provide agent 'embedded' libs
scottopell Oct 22, 2024
f5b5ce3
run of make fmt
scottopell Oct 22, 2024
ae46f9c
Allow wasmtime deps with modified apache2 license
scottopell Oct 22, 2024
3c4e0f3
minor improvements to the make gen-testing-pychecks target
GustavoCaso Oct 22, 2024
a1d43b0
fmt and remove wasmtime (unused)
scottopell Oct 22, 2024
103e467
Adds correct libraries, adds s6 service for ADP
scottopell Oct 22, 2024
db0706a
Add support for building agent-data-plane docker image with 'dev' bui…
scottopell Oct 23, 2024
9e4cfca
Refactors the way checks are initialized, new behavior should be more…
scottopell Oct 23, 2024
87c7781
Sets check_id upon successful init
scottopell Oct 23, 2024
172c3cf
Extends liveness api to support arbitrary json details, records loade…
scottopell Oct 23, 2024
5116590
move check dispatcher into its own file
scottopell Oct 24, 2024
f30ed0b
Removes un-needed 'Runnable' abstraction only used for local python code
scottopell Oct 24, 2024
f5e1fed
Adds more detailed check-instance output
scottopell Oct 24, 2024
7e20535
Log errors during check code import
scottopell Oct 24, 2024
c11072c
Ignores all auto_conf yamls and lowers verbosity of check-metric log
scottopell Oct 24, 2024
c5770ad
Adds required check libraries and defaults to adp image
scottopell Oct 24, 2024
a640691
Adds missing s6 service defs referenced in converged-agent image
scottopell Oct 24, 2024
ac87cfa
Updates pyo3 to latest public release
scottopell Oct 24, 2024
2624bee
Fix noop-health
scottopell Oct 24, 2024
45d66c5
Debug why this is failing in CI
scottopell Oct 24, 2024
e10623e
Updates license metadata
scottopell Oct 24, 2024
51dbdbe
Newer build/smp image
scottopell Oct 25, 2024
bd25d7c
Fix curl
scottopell Oct 25, 2024
7f64c1c
use CI config from branch to build baseline image, required for uncle…
scottopell Oct 25, 2024
baefc10
Fixes formatting
scottopell Oct 25, 2024
c752bb7
Fix checkout ref for baseline build
scottopell Oct 25, 2024
4eb5781
Fix quoting in gitlab benchmark def
scottopell Oct 25, 2024
0c6d273
avoid globs, focus on dirs
scottopell Oct 25, 2024
9f0c00f
Support custom check codes in checks.d dir
scottopell Oct 25, 2024
90d8891
Adds pycheck focused smp experiment
scottopell Oct 25, 2024
8136eb4
Remove dsd-experiments
scottopell Oct 25, 2024
6ef64d8
Enables integration-profiling
scottopell Oct 25, 2024
aaea47e
Use existing borrowed py rather than re-acquiring the gil
scottopell Oct 28, 2024
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: 11 additions & 1 deletion .ci/images/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ARG DD_AGENT_VERSION=7.58.0-jmx
ARG DD_AGENT_IMAGE=datadog/agent:${DD_AGENT_VERSION}

FROM ${DD_AGENT_IMAGE} as agent
FROM registry.ddbuild.io/images/mirror/ubuntu:14.04

ARG RUST_VERSION=1.80.0
Expand Down Expand Up @@ -35,7 +39,13 @@ RUN rustup toolchain add nightly && \
# Pre-install the relevant Cargo tools we use in the build process.
COPY ./Makefile /
RUN make cargo-preinstall


# Import python bits from Agent image.
# Do last in the pipeline to avoid polluting the builds of above protobuf/go etc from using these libs
COPY --from=agent /opt/datadog-agent/embedded/ /opt/datadog-agent/embedded/
ENV LD_LIBRARY_PATH="/opt/datadog-agent/embedded/lib:${LD_LIBRARY_PATH}"
ENV PATH="/opt/datadog-agent/embedded/bin:${PATH}"

COPY .ci/images/build/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
9 changes: 9 additions & 0 deletions .ci/images/general/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ARG DD_AGENT_VERSION=7.58.0-jmx
ARG DD_AGENT_IMAGE=datadog/agent:${DD_AGENT_VERSION}

FROM ${DD_AGENT_IMAGE} as agent
FROM registry.ddbuild.io/images/mirror/ubuntu:20.04

RUN apt-get update && \
Expand All @@ -10,6 +14,11 @@ RUN curl -L https://s3.amazonaws.com/dd-package-public/dd-package-$(dpkg --print
apt-get update && \
dd-package --bucket binaries.ddbuild.io --package devtools/dd-package-dev --distribution "20.04"

# Import python bits from Agent image.
COPY --from=agent /opt/datadog-agent/embedded/ /opt/datadog-agent/embedded/
ENV LD_LIBRARY_PATH="/opt/datadog-agent/embedded/lib:${LD_LIBRARY_PATH}"
ENV PATH="/opt/datadog-agent/embedded/bin:${PATH}"

COPY .ci/images/general/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
10 changes: 10 additions & 0 deletions .ci/images/smp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
ARG DD_AGENT_VERSION=7.58.0-jmx
ARG DD_AGENT_IMAGE=datadog/agent:${DD_AGENT_VERSION}

FROM ${DD_AGENT_IMAGE} as agent

FROM registry.ddbuild.io/images/mirror/ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive \
Expand All @@ -18,6 +23,11 @@ RUN curl -L https://s3.amazonaws.com/dd-package-public/dd-package-$(dpkg --print
COPY .ci/images/smp/install-pr-commenter.sh /
RUN chmod +x /install-pr-commenter.sh && /install-pr-commenter.sh

# Import python bits from Agent image.
COPY --from=agent /opt/datadog-agent/embedded/ /opt/datadog-agent/embedded/
ENV LD_LIBRARY_PATH="/opt/datadog-agent/embedded/lib:${LD_LIBRARY_PATH}"
ENV PATH="/opt/datadog-agent/embedded/bin:${PATH}"

COPY .ci/images/smp/entrypoint.sh /
RUN chmod +x /entrypoint.sh

Expand Down
17 changes: 17 additions & 0 deletions .ci/s6/adp-finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/execlineb -S1

# Disable the service if it exit(0), else wait 2 seconds before restarting it

# First check if ADP exists
if { s6-test -x "/opt/datadog-agent/embedded/bin/agent-data-plane" }

ifthenelse
{ s6-test ${1} -eq 0 }
{
foreground { /initlog.sh "agent-data-plane exited with code ${1}, disabling" }
foreground { /bin/s6-svc -d /var/run/s6/services/adp/ }
}
{
foreground { /initlog.sh "agent-data-plane exited with code ${1}, signal ${2}, restarting in 2 seconds" }
foreground { s6-sleep 2 }
}
12 changes: 12 additions & 0 deletions .ci/s6/adp-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/execlineb -P

# Check if the system-probe exists before running it
ifelse -n
{ s6-test -x "/opt/datadog-agent/embedded/bin/agent-data-plane" }
{
foreground { /initlog.sh "agent-data-plane not bundled, disabling" }
foreground { /bin/s6-svc -d /var/run/s6/services/sysprobe/ }
}
foreground { /initlog.sh "starting agent-data-plane" }

exec /opt/datadog-agent/embedded/bin/agent-data-plane
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.gitlab
/.git
/.vscode
/checks_venv
/docker
/target
/test
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ test/k8s/charts/
test/build/
test/ddprof
test/lading
dist/
checks_venv/
etc-datadog-agent/
dhat-heap.json
.DS_Store
.DS_Store
12 changes: 9 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,22 @@ variables:
# Base repository paths for where our CI images go, whether they're helper images or actual
# output artifacts like ADP itself.
SALUKI_IMAGE_REPO_BASE: "${IMAGE_REGISTRY}/saluki"
SALUKI_BUILD_CI_IMAGE: "${SALUKI_IMAGE_REPO_BASE}/build-ci:v42220630-6ad1da61"
SALUKI_SMP_CI_IMAGE: "${SALUKI_IMAGE_REPO_BASE}/smp-ci:v40512394-da9e8d37"
# Build image built from https://gitlab.ddbuild.io/DataDog/saluki/-/jobs/683779080
SALUKI_BUILD_CI_IMAGE: "${SALUKI_IMAGE_REPO_BASE}/build-ci:v47392904-45d66c50"
# CI image built from https://gitlab.ddbuild.io/DataDog/saluki/-/jobs/683779084
SALUKI_SMP_CI_IMAGE: "${SALUKI_IMAGE_REPO_BASE}/smp-ci:v47392904-45d66c50"
# 'general' image built with dd-python-libs
# registry.ddbuild.io/saluki/general-ci:v47148172-419daeb2
# from https://gitlab.ddbuild.io/DataDog/saluki/-/jobs/680099601


# ADP-specific variables, controlling how we build ADP images, how we version them, and where we push them.
ADP_VERSION_BASE: "0.1.0"
ADP_IMAGE_BASE: "${SALUKI_IMAGE_REPO_BASE}/agent-data-plane"

# Converged Datadog Agent-specific variables, which control how we build the converged Datadog Agent image
# used internally for testing.
DD_AGENT_VERSION: "7-57-0-rc-4-jmx"
DD_AGENT_VERSION: "7-58-0-jmx"
DD_AGENT_IMAGE_BASE: "${IMAGE_REGISTRY}/datadog-agent"
DD_AGENT_IMAGE: "${DD_AGENT_IMAGE_BASE}:${DD_AGENT_VERSION}"

Expand Down
8 changes: 5 additions & 3 deletions .gitlab/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ build-adp-baseline-image:
# Initialize our AWS credentials.
- ./test/smp/configure-smp-aws-credentials.sh

# Build baseline from `main`. A more correct approach here would be to check
# out all but the dockerfile for saluki from the branch point and build that
# way but this should be Good Enough for a while.
# Build baseline from `main`
- git fetch --all
- git switch main

# Preserve Dockerfiles and CI configuration files from the current branch
# Replace the paths below with the actual paths to your Dockerfiles and CI configs
- git checkout origin/"${CI_COMMIT_BRANCH}" -- .gitlab-ci.yml .gitlab/ ./docker/

# Actually build
- aws ecr get-login-password --region us-west-2 --profile ${AWS_NAMED_PROFILE} | docker login --username AWS --password-stdin ${SMP_ECR_HOST}
- docker buildx build
Expand Down
Loading