From 5ccbc2decb9a6df6034f94dc30adea92fc72f6b1 Mon Sep 17 00:00:00 2001 From: Zhengke Zhou Date: Mon, 13 Jan 2025 13:16:28 +0800 Subject: [PATCH] Use jaeger-v2 by default in Hotrod and Monitor examples (#6523) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Which problem is this PR solving? - Resolves #6520 ## Description of the changes - Rename docker-compose.yml to docker-compose-v1.yml - update reference: script, doc, github actions, makefile ## How was this change tested? - ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [ ] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: zzzk1 Co-authored-by: Yuri Shkuro --- docker-compose/monitor/Makefile | 14 ++--- docker-compose/monitor/README.md | 14 ++--- docker-compose/monitor/docker-compose-v1.yml | 54 +++++++++++++++++++ docker-compose/monitor/docker-compose-v2.yml | 39 -------------- docker-compose/monitor/docker-compose.yml | 37 ++++--------- ...r-compose-v2.yml => docker-compose-v1.yml} | 6 +-- examples/hotrod/docker-compose.yml | 6 +-- scripts/build/build-hotrod-image.sh | 10 ++-- scripts/e2e/spm.sh | 12 ++--- 9 files changed, 96 insertions(+), 96 deletions(-) create mode 100644 docker-compose/monitor/docker-compose-v1.yml delete mode 100644 docker-compose/monitor/docker-compose-v2.yml rename examples/hotrod/{docker-compose-v2.yml => docker-compose-v1.yml} (79%) diff --git a/docker-compose/monitor/Makefile b/docker-compose/monitor/Makefile index 821307a2018..1e52bb13f05 100644 --- a/docker-compose/monitor/Makefile +++ b/docker-compose/monitor/Makefile @@ -1,7 +1,7 @@ # Copyright (c) 2024 The Jaeger Authors. # SPDX-License-Identifier: Apache-2.0 -BINARY ?= all-in-one # Default value uses v1 binary +BINARY ?= jaeger # Default value uses v2 binary .PHONY: build build: clean-jaeger @@ -20,13 +20,13 @@ build: clean-jaeger .PHONY: dev dev: export JAEGER_IMAGE_TAG = dev dev: - docker compose -f docker-compose.yml up $(DOCKER_COMPOSE_ARGS) + docker compose up $(DOCKER_COMPOSE_ARGS) -.PHONY: dev-v2 -dev-v2: export JAEGER_IMAGE_TAG = dev -dev-v2: export BINARY = jaeger -dev-v2: build - docker compose -f docker-compose-v2.yml up $(DOCKER_COMPOSE_ARGS) +.PHONY: dev-v1 +dev-v1: export JAEGER_IMAGE_TAG = dev +dev-v1: export BINARY = all-in-one +dev-v1: build + docker compose -f docker-compose-v1.yml up $(DOCKER_COMPOSE_ARGS) .PHONY: clean-jaeger clean-jaeger: diff --git a/docker-compose/monitor/README.md b/docker-compose/monitor/README.md index b020dda7fd9..8cb22765ac6 100644 --- a/docker-compose/monitor/README.md +++ b/docker-compose/monitor/README.md @@ -72,10 +72,10 @@ It uses the latest image tags from both Jaeger and OpenTelemetry. docker compose up ``` -**Jaeger v2** +**Jaeger v1** ```shell -docker compose -f docker-compose-v2.yml up +docker compose -f docker-compose-v1.yml up ``` **Tips:** @@ -83,7 +83,7 @@ docker compose -f docker-compose-v2.yml up - Navigate to Jaeger UI at http://localhost:16686/ and inspect the Monitor tab. Select `redis` service from the dropdown to see more than one endpoint. - To visualize the raw metrics stored on the Prometheus server (for debugging and local development use cases), use the built-in Prometheus UI at http://localhost:9090/query. For example, http://localhost:9090/query?g0.expr=traces_span_metrics_calls_total&g0.tab=0&g0.range_input=5m -**Warning:** The included [docker-compose.yml](./docker-compose.yml) file uses the `latest` version of Jaeger and other components. If your local Docker registry already contains older versions, which may still be tagged as `latest`, you may want to delete those images before running the full set, to ensure consistent behavior: +**Warning:** The included ` docker compose` files use the `latest` version of Jaeger and other components. If your local Docker registry already contains older versions, which may still be tagged as `latest`, you may want to delete those images before running the full set, to ensure consistent behavior: ```bash make clean-all @@ -92,13 +92,13 @@ make clean-all To use an official published image of Jaeger, specify the version via environment variable: ```shell -JAEGER_IMAGE_TAG=1.62.0 docker compose up +JAEGER_IMAGE_TAG=2.0.0 docker compose -f docker-compose.yml up ``` -or for Jaeger v2: +or for Jaeger v1: ```shell -JAEGER_IMAGE_TAG=2.0.0 docker compose -f docker-compose-v2.yml up +JAEGER_IMAGE_TAG=1.62.0 docker compose -f docker-compose-v1.yml up ``` ## Development @@ -107,7 +107,7 @@ These steps allow for running the system necessary for SPM, built from Jaeger's The primary use case is for testing source code changes to the SPM feature locally. -### Build jaeger-all-in-one docker image +### Build jaeger-v2 docker image ```shell make build diff --git a/docker-compose/monitor/docker-compose-v1.yml b/docker-compose/monitor/docker-compose-v1.yml new file mode 100644 index 00000000000..4408c4709c3 --- /dev/null +++ b/docker-compose/monitor/docker-compose-v1.yml @@ -0,0 +1,54 @@ +services: + jaeger: + networks: + - backend + image: jaegertracing/all-in-one:${JAEGER_IMAGE_TAG:-latest} + volumes: + - "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json" + command: --query.ui-config /etc/jaeger/jaeger-ui.json + environment: + - METRICS_STORAGE_TYPE=prometheus + - PROMETHEUS_SERVER_URL=http://prometheus:9090 + - PROMETHEUS_QUERY_NAMESPACE=${PROMETHEUS_QUERY_NAMESPACE:-} + - PROMETHEUS_QUERY_DURATION_UNIT=${PROMETHEUS_QUERY_DURATION_UNIT:-} + - PROMETHEUS_QUERY_NORMALIZE_CALLS=true + - PROMETHEUS_QUERY_NORMALIZE_DURATION=true + ports: + - "16686:16686" + + otel_collector: + networks: + backend: + # This is the host name used in Prometheus scrape configuration. + aliases: [spm_metrics_source] + image: otel/opentelemetry-collector-contrib:${OTEL_IMAGE_TAG:-0.112.0} + volumes: + - ${OTEL_CONFIG_SRC:-./otel-collector-config-connector.yml}:/etc/otelcol/otel-collector-config.yml + command: --config /etc/otelcol/otel-collector-config.yml + depends_on: + - jaeger + ports: + - "8889:8889" + + microsim: + networks: + - backend + image: yurishkuro/microsim:v0.4.1 + command: "-d 24h -s 500ms" + environment: + - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel_collector:4318 + - OTEL_EXPORTER_OTLP_INSECURE=true + depends_on: + - otel_collector + + prometheus: + networks: + - backend + image: prom/prometheus:latest + volumes: + - "./prometheus.yml:/etc/prometheus/prometheus.yml" + ports: + - "9090:9090" + +networks: + backend: diff --git a/docker-compose/monitor/docker-compose-v2.yml b/docker-compose/monitor/docker-compose-v2.yml deleted file mode 100644 index e049f4e2a14..00000000000 --- a/docker-compose/monitor/docker-compose-v2.yml +++ /dev/null @@ -1,39 +0,0 @@ -services: - jaeger: - networks: - backend: - # This is the host name used in Prometheus scrape configuration. - aliases: [spm_metrics_source] - image: jaegertracing/jaeger:${JAEGER_IMAGE_TAG:-latest} - volumes: - - "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json" # Do we need this for v2 ? Seems to be running without this. - - "../../cmd/jaeger/config-spm.yaml:/etc/jaeger/config.yml" - command: ["--config", "/etc/jaeger/config.yml"] - ports: - - "16686:16686" - - "8888:8888" - - "8889:8889" - - "4317:4317" - - "4318:4318" - - microsim: - networks: - - backend - image: yurishkuro/microsim:v0.4.1 - command: "-d 24h -s 500ms" - environment: - - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://jaeger:4318/v1/traces - depends_on: - - jaeger - - prometheus: - networks: - - backend - image: prom/prometheus:v3.1.0 - volumes: - - "./prometheus.yml:/etc/prometheus/prometheus.yml" - ports: - - "9090:9090" - -networks: - backend: diff --git a/docker-compose/monitor/docker-compose.yml b/docker-compose/monitor/docker-compose.yml index 4408c4709c3..e049f4e2a14 100644 --- a/docker-compose/monitor/docker-compose.yml +++ b/docker-compose/monitor/docker-compose.yml @@ -1,34 +1,20 @@ services: jaeger: - networks: - - backend - image: jaegertracing/all-in-one:${JAEGER_IMAGE_TAG:-latest} - volumes: - - "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json" - command: --query.ui-config /etc/jaeger/jaeger-ui.json - environment: - - METRICS_STORAGE_TYPE=prometheus - - PROMETHEUS_SERVER_URL=http://prometheus:9090 - - PROMETHEUS_QUERY_NAMESPACE=${PROMETHEUS_QUERY_NAMESPACE:-} - - PROMETHEUS_QUERY_DURATION_UNIT=${PROMETHEUS_QUERY_DURATION_UNIT:-} - - PROMETHEUS_QUERY_NORMALIZE_CALLS=true - - PROMETHEUS_QUERY_NORMALIZE_DURATION=true - ports: - - "16686:16686" - - otel_collector: networks: backend: # This is the host name used in Prometheus scrape configuration. aliases: [spm_metrics_source] - image: otel/opentelemetry-collector-contrib:${OTEL_IMAGE_TAG:-0.112.0} + image: jaegertracing/jaeger:${JAEGER_IMAGE_TAG:-latest} volumes: - - ${OTEL_CONFIG_SRC:-./otel-collector-config-connector.yml}:/etc/otelcol/otel-collector-config.yml - command: --config /etc/otelcol/otel-collector-config.yml - depends_on: - - jaeger + - "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json" # Do we need this for v2 ? Seems to be running without this. + - "../../cmd/jaeger/config-spm.yaml:/etc/jaeger/config.yml" + command: ["--config", "/etc/jaeger/config.yml"] ports: + - "16686:16686" + - "8888:8888" - "8889:8889" + - "4317:4317" + - "4318:4318" microsim: networks: @@ -36,15 +22,14 @@ services: image: yurishkuro/microsim:v0.4.1 command: "-d 24h -s 500ms" environment: - - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel_collector:4318 - - OTEL_EXPORTER_OTLP_INSECURE=true + - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://jaeger:4318/v1/traces depends_on: - - otel_collector + - jaeger prometheus: networks: - backend - image: prom/prometheus:latest + image: prom/prometheus:v3.1.0 volumes: - "./prometheus.yml:/etc/prometheus/prometheus.yml" ports: diff --git a/examples/hotrod/docker-compose-v2.yml b/examples/hotrod/docker-compose-v1.yml similarity index 79% rename from examples/hotrod/docker-compose-v2.yml rename to examples/hotrod/docker-compose-v1.yml index 3e39faad702..4566e2863da 100644 --- a/examples/hotrod/docker-compose-v2.yml +++ b/examples/hotrod/docker-compose-v1.yml @@ -1,9 +1,9 @@ # To run a specific version of Jaeger, use environment variable, e.g.: -# JAEGER_VERSION=2.0.0 HOTROD_VERSION=1.63.0 docker compose up +# JAEGER_VERSION=1.52 docker compose up services: jaeger: - image: ${REGISTRY:-}jaegertracing/jaeger:${JAEGER_VERSION:-latest} + image: ${REGISTRY:-}jaegertracing/all-in-one:${JAEGER_VERSION:-latest} ports: - "16686:16686" - "4317:4317" @@ -14,7 +14,7 @@ services: - jaeger-example hotrod: - image: ${REGISTRY:-}jaegertracing/example-hotrod:${HOTROD_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/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index 4566e2863da..3e39faad702 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -1,9 +1,9 @@ # To run a specific version of Jaeger, use environment variable, e.g.: -# JAEGER_VERSION=1.52 docker compose up +# JAEGER_VERSION=2.0.0 HOTROD_VERSION=1.63.0 docker compose up services: jaeger: - image: ${REGISTRY:-}jaegertracing/all-in-one:${JAEGER_VERSION:-latest} + image: ${REGISTRY:-}jaegertracing/jaeger:${JAEGER_VERSION:-latest} ports: - "16686:16686" - "4317:4317" @@ -14,7 +14,7 @@ services: - jaeger-example hotrod: - image: ${REGISTRY:-}jaegertracing/example-hotrod:${JAEGER_VERSION:-latest} + image: ${REGISTRY:-}jaegertracing/example-hotrod:${HOTROD_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/build/build-hotrod-image.sh b/scripts/build/build-hotrod-image.sh index 0590c91cfed..c420453631e 100755 --- a/scripts/build/build-hotrod-image.sh +++ b/scripts/build/build-hotrod-image.sh @@ -11,7 +11,7 @@ print_help() { echo "-l: Enable local-only mode that only pushes images to local registry" echo "-o: overwrite image in the target remote repository even if the semver tag already exists" echo "-p: Comma-separated list of platforms to build for (default: all supported)" - echo "-v: Jaeger version to use for hotrod image (v1 or v2, default: v1)" + echo "-v: Jaeger version to use for hotrod image (v1 or v2, default: v2)" echo "-r: Runtime to test with (docker|k8s, default: docker)" exit 1 } @@ -19,8 +19,8 @@ print_help() { docker_compose_file="./examples/hotrod/docker-compose.yml" platforms="$(make echo-linux-platforms)" current_platform="$(go env GOOS)/$(go env GOARCH)" -jaeger_version="v1" -binary="all-in-one" +jaeger_version="v2" +binary="jaeger" FLAGS=() success="false" runtime="docker" @@ -54,11 +54,11 @@ done case "$jaeger_version" in v1) - docker_compose_file="./examples/hotrod/docker-compose.yml" + docker_compose_file="./examples/hotrod/docker-compose-v1.yml" binary="all-in-one" ;; v2) - docker_compose_file="./examples/hotrod/docker-compose-v2.yml" + docker_compose_file="./examples/hotrod/docker-compose.yml" binary="jaeger" ;; *) diff --git a/scripts/e2e/spm.sh b/scripts/e2e/spm.sh index 6d1ac395276..afc0313b408 100755 --- a/scripts/e2e/spm.sh +++ b/scripts/e2e/spm.sh @@ -7,12 +7,12 @@ set -euf -o pipefail print_help() { echo "Usage: $0 [-b binary]" - echo "-b: Which binary to build: 'all-in-one' (default) or 'jaeger' (v2)" + echo "-b: Which binary to build: 'all-in-one' or 'jaeger' (v2) (default)" echo "-h: Print help" exit 1 } -BINARY='all-in-one' +BINARY='jaeger' compose_file=docker-compose/monitor/docker-compose.yml while getopts "b:h" opt; do @@ -28,8 +28,8 @@ done set -x -if [ "$BINARY" == "jaeger" ]; then - compose_file=docker-compose/monitor/docker-compose-v2.yml +if [ "$BINARY" == "all-in-one" ]; then + compose_file=docker-compose/monitor/docker-compose-v1.yml fi timeout=600 @@ -161,9 +161,9 @@ teardown_services() { main() { if [ "$BINARY" == "jaeger" ]; then - (cd docker-compose/monitor && make build BINARY="$BINARY" && make dev-v2 DOCKER_COMPOSE_ARGS="-d") - else (cd docker-compose/monitor && make build BINARY="$BINARY" && make dev DOCKER_COMPOSE_ARGS="-d") + else + (cd docker-compose/monitor && make build BINARY="$BINARY" && make dev-v1 DOCKER_COMPOSE_ARGS="-d") fi wait_for_services check_spm