From c2b6309333633ef397fc557800c702638403a4f1 Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sat, 13 Jul 2024 07:15:37 +0000 Subject: [PATCH 01/15] added a docker-compose for hotrod Signed-off-by: mehul gautam --- docker-compose/hotrod/docker-compose.yml | 38 ++++++++++++++++++++++++ jaeger-ui | 2 +- scripts/hotrod_dummy_test.sh | 21 +++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 docker-compose/hotrod/docker-compose.yml create mode 100755 scripts/hotrod_dummy_test.sh diff --git a/docker-compose/hotrod/docker-compose.yml b/docker-compose/hotrod/docker-compose.yml new file mode 100644 index 00000000000..70b27f31801 --- /dev/null +++ b/docker-compose/hotrod/docker-compose.yml @@ -0,0 +1,38 @@ +version: '3.7' + +# To run a specific version of Jaeger, use environment variable, e.g.: +# JAEGER_VERSION=1.52 docker compose up + +services: + jaeger: + image: jaegertracing/all-in-one:${JAEGER_VERSION:-latest} + ports: + - "16686:16686" + - "4317:4317" + - "4318:4318" + environment: + - LOG_LEVEL=debug + # Since v0.105 the OTEL Collector components default hostname to 'localhost'. + # However, that does not work inside a Docker container, so we listen on all IPs. + - COLLECTOR_OTLP_GRPC_HOST_PORT=0.0.0.0:4317 + - COLLECTOR_OTLP_HTTP_HOST_PORT=0.0.0.0:4318 + networks: + - jaeger-example + hotrod: + image: localhost:5000/jaegertracing/example-hotrod:${GITHUB_SHA:-latest} + # To run the latest trunk build, find the tag at Docker Hub and use the line below + # https://hub.docker.com/r/jaegertracing/example-hotrod-snapshot/tags + #image: jaegertracing/example-hotrod-snapshot:0ab8f2fcb12ff0d10830c1ee3bb52b745522db6c + ports: + - "8080:8080" + - "8083:8083" + command: ["all"] + environment: + - OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318 + networks: + - jaeger-example + depends_on: + - jaeger + +networks: + jaeger-example: diff --git a/jaeger-ui b/jaeger-ui index 1704a9a66ae..560c749b481 160000 --- a/jaeger-ui +++ b/jaeger-ui @@ -1 +1 @@ -Subproject commit 1704a9a66ae780ec6bb2f524116176aa9c8a23f8 +Subproject commit 560c749b481f8244bf76b0afe001174fa9ce11f5 diff --git a/scripts/hotrod_dummy_test.sh b/scripts/hotrod_dummy_test.sh new file mode 100755 index 00000000000..d9b0734a6e9 --- /dev/null +++ b/scripts/hotrod_dummy_test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euxf -o pipefail + +make build-examples GOOS=linux GOARCH=amd64 +make build-examples GOOS=linux GOARCH=s390x +make build-examples GOOS=linux GOARCH=ppc64le +make build-examples GOOS=linux GOARCH=arm64 + +REPO=jaegertracing/example-hotrod +platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" +make prepare-docker-buildx + +# build image locally (-l) for integration test +bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hotrod -p "${platforms}" + + +docker compose -f ./docker-compose/hotrod/docker-compose.yml up -d + +#curl frontend-endpoint +docker compose -f ./docker-compose/hotrod/docker-compose.yml logs hotrod \ No newline at end of file From 5db9cc4001ae4d63692cb89438170d63573e4714 Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sat, 13 Jul 2024 20:16:47 +0000 Subject: [PATCH 02/15] added trace check Signed-off-by: mehul gautam --- scripts/hotrod_dummy_test.sh | 51 +++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/scripts/hotrod_dummy_test.sh b/scripts/hotrod_dummy_test.sh index d9b0734a6e9..187404af934 100755 --- a/scripts/hotrod_dummy_test.sh +++ b/scripts/hotrod_dummy_test.sh @@ -7,7 +7,7 @@ make build-examples GOOS=linux GOARCH=s390x make build-examples GOOS=linux GOARCH=ppc64le make build-examples GOOS=linux GOARCH=arm64 -REPO=jaegertracing/example-hotrod + platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" make prepare-docker-buildx @@ -16,6 +16,51 @@ bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hot docker compose -f ./docker-compose/hotrod/docker-compose.yml up -d +i=0 +while [[ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080)" != "200" && ${i} -lt 30 ]]; do + sleep 1 + i=$((i+1)) +done +body=$(curl localhost:8080) +if [[ $body != *"Rides On Demand"* ]]; then + echo "String \"Rides On Demand\" is not present on the index page" + exit 1 +fi + +curl -X POST "http://localhost:8080/dispatch?customer=123" +# Extract the logs from the docker compose service +logs=$(docker compose -f ./docker-compose/hotrod/docker-compose.yml logs hotrod) + +# Extract the trace_id from the logs +TRACE_ID=$(echo "$logs" | grep -oP '(?<="trace_id": ")[^"]+' | tail -n 1) + + + +JAEGER_QUERY_URL="http://localhost:16686" +EXPECTED_SPANS=10 # Change this to the expected number of spans +MAX_RETRIES=30 +SLEEP_INTERVAL=10 + +# Function to poll Jaeger for the trace +poll_jaeger() { + local trace_id=$1 + local url="${JAEGER_QUERY_URL}/api/traces/${trace_id}" + + curl -s "${url}" | jq '.data[0].spans | length' +} + +# Polling loop +for ((i=1; i<=MAX_RETRIES; i++)); do + span_count=$(poll_jaeger "${TRACE_ID}") + + if [[ "$span_count" -ge "$EXPECTED_SPANS" ]]; then + echo "Trace found with $span_count spans." + exit 0 + fi + + echo "Retry $i/$MAX_RETRIES: Trace not found or insufficient spans ($span_count/$EXPECTED_SPANS). Retrying in $SLEEP_INTERVAL seconds..." + sleep $SLEEP_INTERVAL +done -#curl frontend-endpoint -docker compose -f ./docker-compose/hotrod/docker-compose.yml logs hotrod \ No newline at end of file +echo "Failed to find the trace with the expected number of spans within the timeout period." +exit 1 From 0ef8541ac767bbdf6e28d742518e354c44aa8120 Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sun, 14 Jul 2024 00:21:52 +0000 Subject: [PATCH 03/15] fixed Signed-off-by: mehul gautam --- docker-compose/hotrod/docker-compose.yml | 38 -------------- examples/hotrod/docker-compose.yml | 11 ++-- scripts/hotrod-integration-test.sh | 46 ++++++++++++++--- scripts/hotrod_dummy_test.sh | 66 ------------------------ 4 files changed, 44 insertions(+), 117 deletions(-) delete mode 100644 docker-compose/hotrod/docker-compose.yml delete mode 100755 scripts/hotrod_dummy_test.sh diff --git a/docker-compose/hotrod/docker-compose.yml b/docker-compose/hotrod/docker-compose.yml deleted file mode 100644 index 70b27f31801..00000000000 --- a/docker-compose/hotrod/docker-compose.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: '3.7' - -# To run a specific version of Jaeger, use environment variable, e.g.: -# JAEGER_VERSION=1.52 docker compose up - -services: - jaeger: - image: jaegertracing/all-in-one:${JAEGER_VERSION:-latest} - ports: - - "16686:16686" - - "4317:4317" - - "4318:4318" - environment: - - LOG_LEVEL=debug - # Since v0.105 the OTEL Collector components default hostname to 'localhost'. - # However, that does not work inside a Docker container, so we listen on all IPs. - - COLLECTOR_OTLP_GRPC_HOST_PORT=0.0.0.0:4317 - - COLLECTOR_OTLP_HTTP_HOST_PORT=0.0.0.0:4318 - networks: - - jaeger-example - hotrod: - image: localhost:5000/jaegertracing/example-hotrod:${GITHUB_SHA:-latest} - # To run the latest trunk build, find the tag at Docker Hub and use the line below - # https://hub.docker.com/r/jaegertracing/example-hotrod-snapshot/tags - #image: jaegertracing/example-hotrod-snapshot:0ab8f2fcb12ff0d10830c1ee3bb52b745522db6c - ports: - - "8080:8080" - - "8083:8083" - command: ["all"] - environment: - - OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318 - networks: - - jaeger-example - depends_on: - - jaeger - -networks: - jaeger-example: diff --git a/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index 250f78f82b8..e994cb51e93 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -1,8 +1,5 @@ version: '3.7' -# To run a specific version of Jaeger, use environment variable, e.g.: -# JAEGER_VERSION=1.52 docker compose up - services: jaeger: image: jaegertracing/all-in-one:${JAEGER_VERSION:-latest} @@ -12,13 +9,13 @@ services: - "4318:4318" environment: - LOG_LEVEL=debug + - COLLECTOR_OTLP_GRPC_HOST_PORT=0.0.0.0:4317 + - COLLECTOR_OTLP_HTTP_HOST_PORT=0.0.0.0:4318 networks: - jaeger-example + hotrod: - image: jaegertracing/example-hotrod:${JAEGER_VERSION:-latest} - # To run the latest trunk build, find the tag at Docker Hub and use the line below - # https://hub.docker.com/r/jaegertracing/example-hotrod-snapshot/tags - #image: jaegertracing/example-hotrod-snapshot:0ab8f2fcb12ff0d10830c1ee3bb52b745522db6c + image: ${HOTROD_IMAGE:-jaegertracing/example-hotrod}:${GITHUB_SHA:-${JAEGER_VERSION:-latest}} ports: - "8080:8080" - "8083:8083" diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index 40149bef8ff..f284fc3405f 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -7,16 +7,15 @@ make build-examples GOOS=linux GOARCH=s390x make build-examples GOOS=linux GOARCH=ppc64le make build-examples GOOS=linux GOARCH=arm64 -REPO=jaegertracing/example-hotrod + platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" make prepare-docker-buildx # build image locally (-l) for integration test bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hotrod -p "${platforms}" -# pass --name example-hotrod so that we can do `docker logs example-hotrod` later -export CID -CID=$(docker run -d --name example-hotrod -p 8080:8080 "localhost:5000/${REPO}:${GITHUB_SHA}") +export HOTROD_IMAGE="localhost:5000/jaegertracing/example-hotrod" +docker compose -f ./examples/hotrod/docker-compose.yml up -d i=0 while [[ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080)" != "200" && ${i} -lt 30 ]]; do @@ -28,6 +27,41 @@ if [[ $body != *"Rides On Demand"* ]]; then echo "String \"Rides On Demand\" is not present on the index page" exit 1 fi -docker rm -f "$CID" -bash scripts/build-upload-a-docker-image.sh -c example-hotrod -d examples/hotrod -p "${platforms}" +curl -X POST "http://localhost:8080/dispatch?customer=123" +# Extract the logs from the docker compose service +logs=$(docker compose -f ./examples/hotrod/docker-compose.yml logs hotrod) + +# Extract the trace_id from the logs +TRACE_ID=$(echo "$logs" | grep -oP '(?<="trace_id": ")[^"]+' | tail -n 1) + + + +JAEGER_QUERY_URL="http://localhost:16686" +EXPECTED_SPANS=10 # Change this to the expected number of spans +MAX_RETRIES=30 +SLEEP_INTERVAL=10 + +# Function to poll Jaeger for the trace +poll_jaeger() { + local trace_id=$1 + local url="${JAEGER_QUERY_URL}/api/traces/${trace_id}" + + curl -s "${url}" | jq '.data[0].spans | length' +} + +# Polling loop +for ((i=1; i<=MAX_RETRIES; i++)); do + span_count=$(poll_jaeger "${TRACE_ID}") + + if [[ "$span_count" -ge "$EXPECTED_SPANS" ]]; then + echo "Trace found with $span_count spans." + exit 0 + fi + + echo "Retry $i/$MAX_RETRIES: Trace not found or insufficient spans ($span_count/$EXPECTED_SPANS). Retrying in $SLEEP_INTERVAL seconds..." + sleep $SLEEP_INTERVAL +done + +echo "Failed to find the trace with the expected number of spans within the timeout period." +exit 1 diff --git a/scripts/hotrod_dummy_test.sh b/scripts/hotrod_dummy_test.sh deleted file mode 100755 index 187404af934..00000000000 --- a/scripts/hotrod_dummy_test.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -set -euxf -o pipefail - -make build-examples GOOS=linux GOARCH=amd64 -make build-examples GOOS=linux GOARCH=s390x -make build-examples GOOS=linux GOARCH=ppc64le -make build-examples GOOS=linux GOARCH=arm64 - - -platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" -make prepare-docker-buildx - -# build image locally (-l) for integration test -bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hotrod -p "${platforms}" - - -docker compose -f ./docker-compose/hotrod/docker-compose.yml up -d -i=0 -while [[ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080)" != "200" && ${i} -lt 30 ]]; do - sleep 1 - i=$((i+1)) -done -body=$(curl localhost:8080) -if [[ $body != *"Rides On Demand"* ]]; then - echo "String \"Rides On Demand\" is not present on the index page" - exit 1 -fi - -curl -X POST "http://localhost:8080/dispatch?customer=123" -# Extract the logs from the docker compose service -logs=$(docker compose -f ./docker-compose/hotrod/docker-compose.yml logs hotrod) - -# Extract the trace_id from the logs -TRACE_ID=$(echo "$logs" | grep -oP '(?<="trace_id": ")[^"]+' | tail -n 1) - - - -JAEGER_QUERY_URL="http://localhost:16686" -EXPECTED_SPANS=10 # Change this to the expected number of spans -MAX_RETRIES=30 -SLEEP_INTERVAL=10 - -# Function to poll Jaeger for the trace -poll_jaeger() { - local trace_id=$1 - local url="${JAEGER_QUERY_URL}/api/traces/${trace_id}" - - curl -s "${url}" | jq '.data[0].spans | length' -} - -# Polling loop -for ((i=1; i<=MAX_RETRIES; i++)); do - span_count=$(poll_jaeger "${TRACE_ID}") - - if [[ "$span_count" -ge "$EXPECTED_SPANS" ]]; then - echo "Trace found with $span_count spans." - exit 0 - fi - - echo "Retry $i/$MAX_RETRIES: Trace not found or insufficient spans ($span_count/$EXPECTED_SPANS). Retrying in $SLEEP_INTERVAL seconds..." - sleep $SLEEP_INTERVAL -done - -echo "Failed to find the trace with the expected number of spans within the timeout period." -exit 1 From e15978773b3cfafa7438dba08ef31ac5030aae9c Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sun, 14 Jul 2024 15:16:36 +0000 Subject: [PATCH 04/15] fixed Signed-off-by: mehul gautam --- examples/hotrod/docker-compose.yml | 2 +- jaeger-ui | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 160000 jaeger-ui diff --git a/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index e994cb51e93..488520fce74 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -15,7 +15,7 @@ services: - jaeger-example hotrod: - image: ${HOTROD_IMAGE:-jaegertracing/example-hotrod}:${GITHUB_SHA:-${JAEGER_VERSION:-latest}} + image: ${REGISTRY:-}jaegertracing/example-hotrod:${JAEGER_VERSION:-latest} ports: - "8080:8080" - "8083:8083" diff --git a/jaeger-ui b/jaeger-ui deleted file mode 160000 index 560c749b481..00000000000 --- a/jaeger-ui +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 560c749b481f8244bf76b0afe001174fa9ce11f5 From 85cd331c2d88aaef3d4d617501661f395ee3ca3a Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sun, 14 Jul 2024 15:31:52 +0000 Subject: [PATCH 05/15] fixed Signed-off-by: mehul gautam --- examples/hotrod/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index 488520fce74..e84d3a2ebf5 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -1,4 +1,6 @@ version: '3.7' +# To run a specific version of Jaeger, use environment variable, e.g.: +# JAEGER_VERSION=1.52 docker compose up services: jaeger: From a00f8088339ad644d42fed8018e34eac78b5bdba Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sun, 14 Jul 2024 15:53:21 +0000 Subject: [PATCH 06/15] fixed Signed-off-by: mehul gautam --- jaeger-ui | 1 + scripts/hotrod-integration-test.sh | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) create mode 160000 jaeger-ui diff --git a/jaeger-ui b/jaeger-ui new file mode 160000 index 00000000000..1704a9a66ae --- /dev/null +++ b/jaeger-ui @@ -0,0 +1 @@ +Subproject commit 1704a9a66ae780ec6bb2f524116176aa9c8a23f8 diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index f284fc3405f..22b34de93c0 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -35,8 +35,6 @@ logs=$(docker compose -f ./examples/hotrod/docker-compose.yml logs hotrod) # Extract the trace_id from the logs TRACE_ID=$(echo "$logs" | grep -oP '(?<="trace_id": ")[^"]+' | tail -n 1) - - JAEGER_QUERY_URL="http://localhost:16686" EXPECTED_SPANS=10 # Change this to the expected number of spans MAX_RETRIES=30 From f2f4b95e6ea4fbc05b24a137913917ae3a85a81a Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sun, 14 Jul 2024 15:55:55 +0000 Subject: [PATCH 07/15] fixed Signed-off-by: mehul gautam --- examples/hotrod/docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index e84d3a2ebf5..c034402dca5 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -11,8 +11,6 @@ services: - "4318:4318" environment: - LOG_LEVEL=debug - - COLLECTOR_OTLP_GRPC_HOST_PORT=0.0.0.0:4317 - - COLLECTOR_OTLP_HTTP_HOST_PORT=0.0.0.0:4318 networks: - jaeger-example From 9996f30105cd1473e7b41448fc793277bdd5477e Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sun, 14 Jul 2024 22:24:44 +0000 Subject: [PATCH 08/15] fixed Signed-off-by: mehul gautam --- examples/hotrod/docker-compose.yml | 5 ++++- scripts/hotrod-integration-test.sh | 34 +++++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index c034402dca5..18c93fc6445 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -15,7 +15,10 @@ services: - jaeger-example hotrod: - image: ${REGISTRY:-}jaegertracing/example-hotrod:${JAEGER_VERSION:-latest} + image: ${REGISTRY:-}jaegertracing/example-hotrod:${GITHUB_SHA:-${JAEGER_VERSION:-latest}} + # To run the latest trunk build, find the tag at Docker Hub and use the line below + # https://hub.docker.com/r/jaegertracing/example-hotrod-snapshot/tags + #image: jaegertracing/example-hotrod-snapshot:0ab8f2fcb12ff0d10830c1ee3bb52b745522db6c ports: - "8080:8080" - "8083:8083" diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index 22b34de93c0..ecd292ee579 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -2,43 +2,47 @@ set -euxf -o pipefail +docker_compose_file="./examples/hotrod/docker-compose.yml" +export REGISTRY="localhost:5000/" +platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" + +teardown() { + echo "Tearing down..." + docker compose -f "$docker_compose_file" down +} +trap teardown EXIT + make build-examples GOOS=linux GOARCH=amd64 make build-examples GOOS=linux GOARCH=s390x make build-examples GOOS=linux GOARCH=ppc64le make build-examples GOOS=linux GOARCH=arm64 - -platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" make prepare-docker-buildx -# build image locally (-l) for integration test +# Build image locally (-l) for integration test bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hotrod -p "${platforms}" -export HOTROD_IMAGE="localhost:5000/jaegertracing/example-hotrod" -docker compose -f ./examples/hotrod/docker-compose.yml up -d +docker compose -f "$docker_compose_file" up -d i=0 -while [[ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080)" != "200" && ${i} -lt 30 ]]; do +while [[ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080)" != "200" && $i -lt 30 ]]; do sleep 1 i=$((i+1)) done + body=$(curl localhost:8080) if [[ $body != *"Rides On Demand"* ]]; then echo "String \"Rides On Demand\" is not present on the index page" exit 1 fi -curl -X POST "http://localhost:8080/dispatch?customer=123" -# Extract the logs from the docker compose service -logs=$(docker compose -f ./examples/hotrod/docker-compose.yml logs hotrod) - -# Extract the trace_id from the logs -TRACE_ID=$(echo "$logs" | grep -oP '(?<="trace_id": ")[^"]+' | tail -n 1) +response=$(curl -i -X POST "http://localhost:8080/dispatch?customer=123") +TRACE_ID=$(echo "$response" | grep -Fi "Traceresponse" | awk '{print $2}' | cut -d '-' -f 2) JAEGER_QUERY_URL="http://localhost:16686" -EXPECTED_SPANS=10 # Change this to the expected number of spans -MAX_RETRIES=30 -SLEEP_INTERVAL=10 +EXPECTED_SPANS=10 +MAX_RETRIES=30 +SLEEP_INTERVAL=10 # Function to poll Jaeger for the trace poll_jaeger() { From 5c646036382ede94bad3152cd20917130233d7d9 Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Tue, 16 Jul 2024 18:50:48 +0000 Subject: [PATCH 09/15] fixed Signed-off-by: mehul gautam --- examples/hotrod/docker-compose.yml | 4 ++-- scripts/hotrod-integration-test.sh | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index 18c93fc6445..d416d177363 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -4,7 +4,7 @@ version: '3.7' services: jaeger: - image: jaegertracing/all-in-one:${JAEGER_VERSION:-latest} + image: ${REGISTRY:-}jaegertracing/all-in-one:${JAEGER_VERSION:-latest} ports: - "16686:16686" - "4317:4317" @@ -15,7 +15,7 @@ services: - jaeger-example hotrod: - image: ${REGISTRY:-}jaegertracing/example-hotrod:${GITHUB_SHA:-${JAEGER_VERSION:-latest}} + image: ${REGISTRY:-}jaegertracing/example-hotrod:${JAEGER_VERSION:-latest} # To run the latest trunk build, find the tag at Docker Hub and use the line below # https://hub.docker.com/r/jaegertracing/example-hotrod-snapshot/tags #image: jaegertracing/example-hotrod-snapshot:0ab8f2fcb12ff0d10830c1ee3bb52b745522db6c diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index ecd292ee579..86ecc0f77dd 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -3,7 +3,6 @@ set -euxf -o pipefail docker_compose_file="./examples/hotrod/docker-compose.yml" -export REGISTRY="localhost:5000/" platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" teardown() { @@ -18,11 +17,13 @@ make build-examples GOOS=linux GOARCH=ppc64le make build-examples GOOS=linux GOARCH=arm64 make prepare-docker-buildx +make create-baseimg # Build image locally (-l) for integration test bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hotrod -p "${platforms}" +bash scripts/build-upload-a-docker-image.sh -l -b -c all-in-one -d cmd/all-in-one -p "${platforms}" -t release -docker compose -f "$docker_compose_file" up -d +JAEGER_VERSION=$GITHUB_SHA REGISTRY="localhost:5000/" docker compose -f "$docker_compose_file" up -d i=0 while [[ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080)" != "200" && $i -lt 30 ]]; do From 6801015aca325c4d01662cdeecc66908134fffc8 Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Tue, 16 Jul 2024 19:00:05 +0000 Subject: [PATCH 10/15] fixed ci logs Signed-off-by: mehul gautam --- .github/workflows/ci-hotrod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-hotrod.yml b/.github/workflows/ci-hotrod.yml index 16f39344404..1bba419d9a9 100644 --- a/.github/workflows/ci-hotrod.yml +++ b/.github/workflows/ci-hotrod.yml @@ -51,5 +51,5 @@ jobs: QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} - name: Print logs from hotrod - run: docker logs example-hotrod + run: docker compose -f ./examples/hotrod/docker-compose.yml logs if: failure() From 75452050d0714cd4c9c6ca29794acefac91c5cf8 Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Tue, 16 Jul 2024 19:10:59 +0000 Subject: [PATCH 11/15] fixed Signed-off-by: mehul gautam --- scripts/hotrod-integration-test.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index 86ecc0f77dd..bffb911d6ee 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -19,6 +19,13 @@ make build-examples GOOS=linux GOARCH=arm64 make prepare-docker-buildx make create-baseimg +# Loop through each platform (separated by commas) +for platform in $(echo "$platforms" | tr ',' ' '); do + # Extract the architecture from the platform string + arch=${platform##*/} # Remove everything before the last slash + make "build-all-in-one" GOOS=linux GOARCH="${arch}" +done + # Build image locally (-l) for integration test bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hotrod -p "${platforms}" bash scripts/build-upload-a-docker-image.sh -l -b -c all-in-one -d cmd/all-in-one -p "${platforms}" -t release From 6b62341718142ed2357f0fbbcac81fb6c98641bb Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Wed, 17 Jul 2024 04:39:22 +0000 Subject: [PATCH 12/15] fixed Signed-off-by: mehul gautam --- examples/hotrod/docker-compose.yml | 2 +- scripts/hotrod-integration-test.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index d416d177363..048de7de59e 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -1,6 +1,6 @@ version: '3.7' # To run a specific version of Jaeger, use environment variable, e.g.: -# JAEGER_VERSION=1.52 docker compose up +# JAEGER_VERSION=1.52 docker compose up services: jaeger: diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index bffb911d6ee..f6085140b69 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -47,8 +47,15 @@ fi response=$(curl -i -X POST "http://localhost:8080/dispatch?customer=123") TRACE_ID=$(echo "$response" | grep -Fi "Traceresponse" | awk '{print $2}' | cut -d '-' -f 2) +if [ -n "$TRACE_ID" ]; then + echo "TRACE_ID is not empty: $TRACE_ID" +else + echo "TRACE_ID is empty" + exit 1 +fi + JAEGER_QUERY_URL="http://localhost:16686" -EXPECTED_SPANS=10 +EXPECTED_SPANS=35 MAX_RETRIES=30 SLEEP_INTERVAL=10 From bd5a86e5a607374c53b35a7404d71a81fd291f0d Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Wed, 17 Jul 2024 05:20:09 +0000 Subject: [PATCH 13/15] return 0 if jq fails Signed-off-by: mehul gautam --- scripts/hotrod-integration-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index f6085140b69..690da495df9 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -45,7 +45,7 @@ if [[ $body != *"Rides On Demand"* ]]; then fi response=$(curl -i -X POST "http://localhost:8080/dispatch?customer=123") -TRACE_ID=$(echo "$response" | grep -Fi "Traceresponse" | awk '{print $2}' | cut -d '-' -f 2) +TRACE_ID=$(echo "$response" | grep -Fi "Traceresponse:" | awk '{print $2}' | cut -d '-' -f 2) if [ -n "$TRACE_ID" ]; then echo "TRACE_ID is not empty: $TRACE_ID" @@ -64,7 +64,7 @@ poll_jaeger() { local trace_id=$1 local url="${JAEGER_QUERY_URL}/api/traces/${trace_id}" - curl -s "${url}" | jq '.data[0].spans | length' + curl -s "${url}" | jq '.data[0].spans | length' || 0 } # Polling loop From 50b014f1654a20553fd768bb87e287a4d7cca767 Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Wed, 17 Jul 2024 06:24:36 +0000 Subject: [PATCH 14/15] fixed Signed-off-by: mehul gautam --- scripts/hotrod-integration-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index 690da495df9..019021330a5 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -64,7 +64,7 @@ poll_jaeger() { local trace_id=$1 local url="${JAEGER_QUERY_URL}/api/traces/${trace_id}" - curl -s "${url}" | jq '.data[0].spans | length' || 0 + curl -s "${url}" | jq 'fieajfoejsfses | length' || echo "0" } # Polling loop From 7ab621481aaf303b5bb35bbf04b809cd25265186 Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Wed, 17 Jul 2024 07:51:23 +0000 Subject: [PATCH 15/15] Fixed Signed-off-by: mehul gautam --- scripts/hotrod-integration-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index 019021330a5..8fc080e9378 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -64,7 +64,7 @@ poll_jaeger() { local trace_id=$1 local url="${JAEGER_QUERY_URL}/api/traces/${trace_id}" - curl -s "${url}" | jq 'fieajfoejsfses | length' || echo "0" + curl -s "${url}" | jq '.data[0].spans | length' || echo "0" } # Polling loop