Skip to content

Commit

Permalink
[cpp] Use healtcheck to get version #2799
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeauchesne committed Oct 9, 2024
1 parent 5cdb5d5 commit b01ac73
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions utils/_context/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def configure(self, replay):
)

# https://github.com/DataDog/system-tests/issues/2799
if self.library in ("dotnet", "nodejs", "python", "golang", "ruby"):
if self.library in ("cpp", "dotnet", "nodejs", "python", "golang", "ruby"):
self.healthcheck = {
"test": f"curl --fail --silent --show-error --max-time 2 localhost:{self.port}/healthcheck",
"retries": 60,
Expand Down Expand Up @@ -727,7 +727,7 @@ def post_start(self):

# new way of getting info from the weblog. Only working for nodejs and python right now
# https://github.com/DataDog/system-tests/issues/2799
if self.library in ("dotnet", "nodejs", "python", "golang", "ruby"):
if self.library in ("cpp", "dotnet", "nodejs", "python", "golang", "ruby"):
with open(self.healthcheck_log_file, mode="r", encoding="utf-8") as f:
data = json.load(f)
lib = data["library"]
Expand Down
6 changes: 4 additions & 2 deletions utils/build/docker/cpp/nginx/install_ddtrace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ else
rm "$TARBALL"
fi

strings /usr/lib/nginx/modules/ngx_http_datadog_module.so | grep -F "[dd-trace-cpp version" | sed 's/.* version \([^]]\+\).*/\1/' > SYSTEM_TESTS_LIBRARY_VERSION
VERSION=$(strings /usr/lib/nginx/modules/ngx_http_datadog_module.so | grep -F "[dd-trace-cpp version" | sed 's/.* version \([^]]\+\).*/\1/')
echo '{"status": "ok", "library": {"language": "cpp", "version": "'$VERSION'"}}' > /builds/healthcheck.json
echo $VERSION > SYSTEM_TESTS_LIBRARY_VERSION
echo "Library version : $VERSION"

echo "Library version : $(cat SYSTEM_TESTS_LIBRARY_VERSION)"
5 changes: 5 additions & 0 deletions utils/build/docker/cpp/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ http {
try_files /hello.html =404;
}

location /healthcheck {
root /builds;
try_files /healthcheck.json =404;
}

location / {
root /builds;
try_files /hello.html =404;
Expand Down

0 comments on commit b01ac73

Please sign in to comment.