Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions docs/execute/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Build images used for system tests.
* `php`
* `python`
* `ruby`
* `rust`

`cpp` is not available for `build.sh` because only parametric tests are runnable for `dd-trace-cpp`.

Expand All @@ -46,6 +47,7 @@ Build images used for system tests.
* For `php`: `apache-mod-8.1`, `apache-mod-8.0` (default), `apache-mod-7.4`, `apache-mod-7.3`, `apache-mod-7.2`, `apache-mod-7.1`, `apache-mod-7.0`, `apache-mod-8.1-zts`, `apache-mod-8.0-zts`, `apache-mod-7.4-zts`, `apache-mod-7.3-zts`, `apache-mod-7.2-zts`, `apache-mod-7.1-zts`, `apache-mod-7.0-zts`, `php-fpm-8.1`, `php-fpm-8.0`, `php-fpm-7.4`, `php-fpm-7.3`, `php-fpm-7.2`, `php-fpm-7.1`, `php-fpm-7.0`
* For `python`: `flask-poc` (default), `fastapi`, `uwsgi-poc`, `django-poc`, `python3.12`
* For `ruby`: `rails70` (default), `rack`, `sinatra21`, and lot of other sinatra/rails versions
* For `rust`: `axum` (default)


## Real life examples
Expand Down
2 changes: 1 addition & 1 deletion manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ manifest:
tests/k8s_lib_injection/test_k8s_lib_injection_profiling.py::TestK8sLibInjectioProfilingClusterOverride: v1.9.0
tests/k8s_lib_injection/test_k8s_lib_injection_profiling.py::TestK8sLibInjectioProfilingDisabledByDefault: v1.9.0
tests/otel/test_context_propagation.py::Test_Otel_Context_Propagation_Default_Propagator_Api: incomplete_test_app (endpoint not implemented)
tests/otel/test_tracing_otlp.py::Test_Otel_Tracing_OTLP: missing_feature
tests/otel/test_tracing_otlp.py::Test_Otel_Tracing_OTLP: v1.21.0-dev
tests/otel_tracing_e2e/test_e2e.py::Test_OTelLogE2E: irrelevant
tests/otel_tracing_e2e/test_e2e.py::Test_OTelMetricE2E: irrelevant
tests/otel_tracing_e2e/test_e2e.py::Test_OTelTracingE2E: irrelevant
Expand Down
2 changes: 1 addition & 1 deletion manifests/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@ manifest:
"*": incomplete_test_app (endpoint not implemented)
rails72: v2.0.0
tests/otel/test_context_propagation.py::Test_Otel_Context_Propagation_Default_Propagator_Api::test_propagation_extract: incomplete_test_app (Ruby extract seems to fail even though it should be supported)
tests/otel/test_tracing_otlp.py::Test_Otel_Tracing_OTLP: missing_feature
tests/otel/test_tracing_otlp.py::Test_Otel_Tracing_OTLP: v2.36.0-dev
tests/otel_tracing_e2e/test_e2e.py::Test_OTelLogE2E: irrelevant
tests/otel_tracing_e2e/test_e2e.py::Test_OTelMetricE2E: irrelevant
tests/otel_tracing_e2e/test_e2e.py::Test_OTelTracingE2E: irrelevant
Expand Down
2 changes: 1 addition & 1 deletion manifests/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ manifest:
tests/integrations/test_mongo.py::Test_Mongo: missing_feature (Endpoint is not implemented on weblog)
tests/integrations/test_service_overrides.py::Test_SqlServiceNameSource: irrelevant (Only implemented for Java)
tests/integrations/test_sql.py::Test_Sql: missing_feature (Endpoint is not implemented on weblog)
tests/otel/test_tracing_otlp.py::Test_Otel_Tracing_OTLP: missing_feature
tests/otel/test_tracing_otlp.py::Test_Otel_Tracing_OTLP: v0.3.4-dev
tests/otel_tracing_e2e/test_e2e.py::Test_OTelLogE2E: irrelevant
tests/otel_tracing_e2e/test_e2e.py::Test_OTelMetricE2E: irrelevant
tests/otel_tracing_e2e/test_e2e.py::Test_OTelTracingE2E: irrelevant
Expand Down
37 changes: 37 additions & 0 deletions utils/build/docker/rust/axum.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM rust:1.87-slim-bookworm AS builder
WORKDIR /usr/app

# Bring in the weblog sources.
COPY utils/build/docker/rust/weblog .

# Bring in the binaries folder, which may contain a dd-trace-rs checkout and/or a rust-load-from-git file.
COPY binaries/ /binaries/

RUN apt-get update && apt-get install -y --no-install-recommends openssh-client git jq build-essential perl libssl-dev pkg-config curl

# Resolves the dd-trace-rs source into /binaries/dd-trace-rs and stamps a -dev version (trace-only,
# no gRPC features) so this builds against the feature branch on the rust:1.87 toolchain.
RUN bash ./install_ddtrace.sh

RUN \
--mount=type=cache,target=/usr/app/target/ \
--mount=type=cache,target=/usr/local/cargo/registry/ \
cargo build --release && cp ./target/release/weblog /usr/app/weblog

# Resolve the tracer version from the lockfile so the weblog can report it on /healthcheck.
RUN ./system_tests_library_version.sh > /usr/app/SYSTEM_TESTS_LIBRARY_VERSION

FROM debian:bookworm-slim AS final
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/app/weblog /usr/app/weblog
COPY --from=builder /usr/app/Cargo.lock /usr/app/Cargo.lock
COPY --from=builder /usr/app/SYSTEM_TESTS_LIBRARY_VERSION /usr/app/SYSTEM_TESTS_LIBRARY_VERSION

WORKDIR /usr/app

# The harness invokes ./app.sh; export the resolved tracer version so /healthcheck can return it.
RUN printf '#!/bin/bash\nexport SYSTEM_TESTS_LIBRARY_VERSION="$(cat /usr/app/SYSTEM_TESTS_LIBRARY_VERSION)"\nexec ./weblog\n' > app.sh \
&& chmod +x app.sh

CMD ["./app.sh"]
1 change: 1 addition & 0 deletions utils/build/docker/rust/weblog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
37 changes: 37 additions & 0 deletions utils/build/docker/rust/weblog/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "weblog"
version = "0.0.1"
description = "Dockerized Rust/Axum based HTTP weblog for end-to-end System tests"
edition = "2021"
license = "Apache-2.0"
publish = false

rust-version = "1.87" # should match Dockerfile rustc version

[[bin]]
name = "weblog"
path = "src/main.rs"
doc = false
bench = false

[dependencies]
anyhow = { version = "1.0" }
axum = { version = "0.8.4", features = [ "http1", "json", "query" ] }
hyper = { version = "1.0", features = ["client", "http1"] }
hyper-util = { version = "0.1", features = ["tokio", "client", "client-legacy", "http1"] }
http-body-util = { version = "0.1" }
reqwest = { version = "0.12", default-features = false, features = ["json"] }
serde = { version = "1.0", features = [ "derive" ] }
serde_json = { version = "1.0" }
tokio = { version = "1", features = [ "macros", "rt-multi-thread", "signal", "net" ] }
tracing = { version = "0.1", default-features = false }
tracing-subscriber = { version = "0.3", default-features = false, features = [ "env-filter", "fmt" ] }
opentelemetry = { version = "0.31.0" }
opentelemetry_sdk = { version = "0.31.0" }
opentelemetry-http = { version = "0.31.0" }
opentelemetry-semantic-conventions = { version = "0.31.0", features = [ "semconv_experimental" ] }

# Trace-only OTLP export: default features (no metrics/logs gRPC), which keeps the dependency tree
# off tonic and lets this build on the rust:1.87 base image. The path points at the dd-trace-rs
# checkout placed in /binaries by the weblog build (see axum.Dockerfile).
datadog-opentelemetry = { path = "/binaries/dd-trace-rs/datadog-opentelemetry" }
56 changes: 56 additions & 0 deletions utils/build/docker/rust/weblog/install_ddtrace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# Prepares the dd-trace-rs (datadog-opentelemetry) source the weblog depends on.
#
# Unlike the parametric install_ddtrace.sh, this script does NOT enable the metrics/logs gRPC
# features: the OTLP trace-export weblog only needs trace export over http/json, and pulling in
# tonic via the gRPC features raises the minimum rustc above the base image's toolchain.
#
# Resolution order:
# 1. /binaries/rust-load-from-git present -> clone that branch/ref of dd-trace-rs.
# 2. /binaries/dd-trace-rs present -> use the pre-supplied checkout as-is.
# 3. otherwise -> swap the path dependency for the crates.io release.

set -eu

cd /usr/app

REPO_URL=https://github.com/DataDog/dd-trace-rs

if [ -e /binaries/rust-load-from-git ] && [ ! -e /binaries/dd-trace-rs ]; then
rev_or_branch=$(</binaries/rust-load-from-git)
echo "Clone $REPO_URL -b $rev_or_branch into /binaries/dd-trace-rs"
git clone -b "$rev_or_branch" "$REPO_URL" /binaries/dd-trace-rs
fi

if [ -e /binaries/dd-trace-rs ]; then
echo "Using dd-trace-rs from /binaries/dd-trace-rs"

cd /binaries/dd-trace-rs

# Stamp a -dev version so system-tests treats this as an unreleased/in-development build.
current_version=$(cargo metadata --no-deps --format-version 1 \
| jq -r '.packages[] | select(.name == "datadog-opentelemetry") | .version')

IFS=. read -r major minor patch <<<"$current_version"
if [[ -z "${minor:-}" || -z "${patch:-}" ]]; then
echo "expected semver MAJOR.MINOR.PATCH, got: $current_version" >&2
exit 1
fi
new_version="${major}.${minor}.$((patch + 1))"

if [ -e /binaries/dd-trace-rs/.git ]; then
dev_version="${new_version}-dev+$(git -C /binaries/dd-trace-rs rev-parse --short HEAD)"
else
dev_version="${new_version}-dev"
fi

echo "generating dev version $dev_version from $current_version"
sed -i "s/^version = \"${current_version}\"/version = \"${dev_version}\"/" /binaries/dd-trace-rs/Cargo.toml

cd /usr/app
else
echo "No local dd-trace-rs checkout; using crates.io release"
cargo remove datadog-opentelemetry || true
cargo add datadog-opentelemetry
fi
Loading
Loading