From 9e51b06b423f397bfc93dfdf45d269c5b40708c5 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 9 Dec 2024 21:11:26 +0530 Subject: [PATCH 01/53] script to scrape metrics Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-all.yml | 22 +++++++++-- scripts/scrap-metrics.sh | 67 ++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 scripts/scrap-metrics.sh diff --git a/.github/workflows/ci-e2e-all.yml b/.github/workflows/ci-e2e-all.yml index fb41a17b5c5..fc053eccd72 100644 --- a/.github/workflows/ci-e2e-all.yml +++ b/.github/workflows/ci-e2e-all.yml @@ -1,4 +1,4 @@ -name: E2E Tests +name: E2E Tests with meti on: push: @@ -36,7 +36,23 @@ jobs: opensearch: uses: ./.github/workflows/ci-e2e-opensearch.yml - - + metrics-collection: + needs: [badger, cassandra, elasticsearch, grpc, kafka, memory, opensearch] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Scrape Jaeger metrics + run: | + mkdir -p metrics + ./scrape_metrics.sh -c collector -o metrics + ./scrape_metrics.sh -c query -o metrics + + - name: Upload metrics artifacts + uses: actions/upload-artifact@v3 + with: + name: jaeger-metrics + path: metrics/ + retention-days: 7 diff --git a/scripts/scrap-metrics.sh b/scripts/scrap-metrics.sh new file mode 100644 index 00000000000..77ba65ad96e --- /dev/null +++ b/scripts/scrap-metrics.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + +set -euf -o pipefail + +print_help() { + echo "Usage: $0 [-c component] [-o output_dir]" + echo " -c: Jaeger component (agent, collector, query, ingester, all-in-one)" + echo " -o: Output directory for metrics files" + exit 1 +} + +# Default values +component="" +output_dir="./metrics" + +# Jaeger component metrics ports +declare -A COMPONENT_PORTS=( + ["agent"]=14271 + ["collector"]=14269 + ["query"]=16687 + ["ingester"]=14270 + ["all-in-one"]=14269 +) + +# Parse arguments +while getopts "c:o:" opt; do + case "${opt}" in + c) + component="${OPTARG}" + ;; + o) + output_dir="${OPTARG}" + ;; + ?) + print_help + ;; + esac +done + +# Metrics scraping function +scrape_metrics() { + local component=$1 + local port=${COMPONENT_PORTS[$component]} + local output_file="${output_dir}/jaeger_${component}_metrics.txt" + + if [ -z "$port" ]; then + echo "Unknown Jaeger component: $component" + exit 1 + fi + + # Create output directory if it doesn't exist + mkdir -p "$output_dir" + + curl -s "http://localhost:$port/metrics" > "$output_file" + echo "Metrics for $component saved to $output_file" +} + + +if [ -z "$component" ]; then + echo "Component is required" + print_help +fi + +scrape_metrics "$component" \ No newline at end of file From cf2ee8722ba4d7fae9b86434770d8e6342a5adbf Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 9 Dec 2024 21:29:27 +0530 Subject: [PATCH 02/53] minor change Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-all.yml | 1 - scripts/{scrap-metrics.sh => scrape-metrics.sh} | 0 2 files changed, 1 deletion(-) rename scripts/{scrap-metrics.sh => scrape-metrics.sh} (100%) diff --git a/.github/workflows/ci-e2e-all.yml b/.github/workflows/ci-e2e-all.yml index fc053eccd72..d984529ae18 100644 --- a/.github/workflows/ci-e2e-all.yml +++ b/.github/workflows/ci-e2e-all.yml @@ -44,7 +44,6 @@ jobs: - name: Scrape Jaeger metrics run: | - mkdir -p metrics ./scrape_metrics.sh -c collector -o metrics ./scrape_metrics.sh -c query -o metrics diff --git a/scripts/scrap-metrics.sh b/scripts/scrape-metrics.sh similarity index 100% rename from scripts/scrap-metrics.sh rename to scripts/scrape-metrics.sh From 3472d1e9f9e20d9890515ff26990ad592048872f Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 9 Dec 2024 21:41:41 +0530 Subject: [PATCH 03/53] fix dir path Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-all.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-e2e-all.yml b/.github/workflows/ci-e2e-all.yml index d984529ae18..5c9edd48f60 100644 --- a/.github/workflows/ci-e2e-all.yml +++ b/.github/workflows/ci-e2e-all.yml @@ -44,8 +44,8 @@ jobs: - name: Scrape Jaeger metrics run: | - ./scrape_metrics.sh -c collector -o metrics - ./scrape_metrics.sh -c query -o metrics + bash scripts/scrape-metrics.sh -c collector -o metrics + bash scripts/scrape-metrics.sh -c query -o metrics - name: Upload metrics artifacts uses: actions/upload-artifact@v3 From 1c1268282b65f3e2f8f13a19d0ed675b9ee7ba47 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 10 Dec 2024 01:01:44 +0530 Subject: [PATCH 04/53] add metric upload to each test and changes in the scrape script Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-all.yml | 19 -------- .github/workflows/ci-e2e-badger.yaml | 11 +++++ .github/workflows/ci-e2e-cassandra.yml | 11 +++++ .github/workflows/ci-e2e-elasticsearch.yml | 13 ++++- .github/workflows/ci-e2e-grpc.yml | 11 +++++ .github/workflows/ci-e2e-kafka.yml | 11 +++++ .github/workflows/ci-e2e-memory.yaml | 13 ++++- .github/workflows/ci-e2e-opensearch.yml | 11 +++++ scripts/scrape-metrics.sh | 57 +++++++++++----------- 9 files changed, 107 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci-e2e-all.yml b/.github/workflows/ci-e2e-all.yml index 5c9edd48f60..6ab16de928c 100644 --- a/.github/workflows/ci-e2e-all.yml +++ b/.github/workflows/ci-e2e-all.yml @@ -36,22 +36,3 @@ jobs: opensearch: uses: ./.github/workflows/ci-e2e-opensearch.yml - metrics-collection: - needs: [badger, cassandra, elasticsearch, grpc, kafka, memory, opensearch] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Scrape Jaeger metrics - run: | - bash scripts/scrape-metrics.sh -c collector -o metrics - bash scripts/scrape-metrics.sh -c query -o metrics - - - name: Upload metrics artifacts - uses: actions/upload-artifact@v3 - with: - name: jaeger-metrics - path: metrics/ - retention-days: 7 - - diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 5b87cd4e448..cd374d267a6 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -40,6 +40,17 @@ jobs: STORAGE=badger make jaeger-v2-storage-integration-test ;; esac + + - name: Scrape Metrics + run: | + bash scripts/scrape-metrics.sh -t badger-${{ matrix.version }} + + - name: Upload Metrics Artifact + uses: actions/upload-artifact@v3 + with: + name: badger-metrics-${{ matrix.version }} + path: ./metrics/badger-${{ matrix.version }}_metrics.txt + retention-days: 7 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 2e5cb4b561c..f16b9f4baa6 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -49,6 +49,17 @@ jobs: env: SKIP_APPLY_SCHEMA: ${{ matrix.create-schema == 'auto' && true || false }} + - name: Scrape Metrics + run: | + bash scripts/scrape-metrics.sh -t cassandra-${{ matrix.version }} + + - name: Upload Metrics Artifact + uses: actions/upload-artifact@v3 + with: + name: cassandra-metrics-${{ matrix.version }} + path: ./metrics/cassandra-${{ matrix.version }}_metrics.txt + retention-days: 7 + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 548775f9e97..098218f72be 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -58,7 +58,18 @@ jobs: - name: Run ${{ matrix.version.distribution }} integration tests id: test-execution run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - + + - name: Scrape Metrics + run: | + bash scripts/scrape-metrics.sh -t es-${{ matrix.version }} + + - name: Upload Metrics Artifact + uses: actions/upload-artifact@v3 + with: + name: es-metrics-${{ matrix.version }} + path: ./metrics/es-${{ matrix.version }}_metrics.txt + retention-days: 7 + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 3d2eb1806d3..73cf8982cf5 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -41,6 +41,17 @@ jobs: ;; esac + - name: Scrape Metrics + run: | + bash scripts/scrape-metrics.sh -t grpc-${{ matrix.version }} + + - name: Upload Metrics Artifact + uses: actions/upload-artifact@v3 + with: + name: grpc-metrics-${{ matrix.version }} + path: ./metrics/grpc-${{ matrix.version }}_metrics.txt + retention-days: 7 + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index d56d0046803..2ddf0b7694a 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -35,6 +35,17 @@ jobs: id: test-execution run: bash scripts/kafka-integration-test.sh -j ${{ matrix.jaeger-version }} + - name: Scrape Metrics + run: | + bash scripts/scrape-metrics.sh -t kafka-${{ matrix.version }} + + - name: Upload Metrics Artifact + uses: actions/upload-artifact@v3 + with: + name: kafka-metrics-${{ matrix.version }} + path: ./metrics/kafka-${{ matrix.version }}_metrics.txt + retention-days: 7 + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 3408d459852..eac3f13c26f 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -29,7 +29,18 @@ jobs: - name: Run Memory storage integration tests run: | STORAGE=memory_v2 make jaeger-v2-storage-integration-test - + + - name: Scrape Metrics + run: | + bash scripts/scrape-metrics.sh -t memory-${{ matrix.version }} + + - name: Upload Metrics Artifact + uses: actions/upload-artifact@v3 + with: + name: memory-metrics-${{ matrix.version }} + path: ./metrics/memory-${{ matrix.version }}_metrics.txt + retention-days: 7 + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index de98e61e095..ede2760857f 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -52,6 +52,17 @@ jobs: id: test-execution run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} + - name: Scrape Metrics + run: | + bash scripts/scrape-metrics.sh -t opensearch-${{ matrix.version }} + + - name: Upload Metrics Artifact + uses: actions/upload-artifact@v3 + with: + name: opensearch-metrics-${{ matrix.version }} + path: ./metrics/opensearch-${{ matrix.version }}_metrics.txt + retention-days: 7 + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/scripts/scrape-metrics.sh b/scripts/scrape-metrics.sh index 77ba65ad96e..cce8a7c7a19 100644 --- a/scripts/scrape-metrics.sh +++ b/scripts/scrape-metrics.sh @@ -6,30 +6,25 @@ set -euf -o pipefail print_help() { - echo "Usage: $0 [-c component] [-o output_dir]" - echo " -c: Jaeger component (agent, collector, query, ingester, all-in-one)" + echo "Usage: $0 [-t test_type] [-p port] [-o output directory]" + echo " -t: Test type (badger, cassandra, etc.)" + echo " -p: Metrics port (default: 8888)" echo " -o: Output directory for metrics files" exit 1 } -# Default values -component="" +test_type="" +port=8888 output_dir="./metrics" -# Jaeger component metrics ports -declare -A COMPONENT_PORTS=( - ["agent"]=14271 - ["collector"]=14269 - ["query"]=16687 - ["ingester"]=14270 - ["all-in-one"]=14269 -) - # Parse arguments -while getopts "c:o:" opt; do +while getopts "t:p:o:" opt; do case "${opt}" in - c) - component="${OPTARG}" + t) + test_type="${OPTARG}" + ;; + p) + port="${OPTARG}" ;; o) output_dir="${OPTARG}" @@ -42,26 +37,30 @@ done # Metrics scraping function scrape_metrics() { - local component=$1 - local port=${COMPONENT_PORTS[$component]} - local output_file="${output_dir}/jaeger_${component}_metrics.txt" + local test_type=$1 + local port=$2 + local output_file="${output_dir}/${test_type}_metrics.txt" - if [ -z "$port" ]; then - echo "Unknown Jaeger component: $component" + # Create output directory if it doesn't exist + mkdir -p "$output_dir" + + if [ -z "$test_type" ]; then + echo "Test type is required" exit 1 fi - # Create output directory if it doesn't exist - mkdir -p "$output_dir" + if ! curl -s "http://localhost:$port/metrics" > "$output_file"; then + echo "Failed to scrape metrics for $test_type from port $port" + exit 1 + fi - curl -s "http://localhost:$port/metrics" > "$output_file" - echo "Metrics for $component saved to $output_file" + echo "Metrics for $test_type saved to $output_file" } - -if [ -z "$component" ]; then - echo "Component is required" +if [ -z "$test_type" ]; then + echo "Test type is required" print_help fi -scrape_metrics "$component" \ No newline at end of file +# Scrape metrics +scrape_metrics "$test_type" "$port" \ No newline at end of file From d5ae8f5d2dc78d8ea30274eccb435c07a320cc57 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Thu, 12 Dec 2024 00:44:13 +0530 Subject: [PATCH 05/53] minor changes Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-elasticsearch.yml | 6 +----- scripts/es-integration-test.sh | 3 +++ scripts/scrape-metrics.sh | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) mode change 100644 => 100755 scripts/scrape-metrics.sh diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 098218f72be..8bd413e6c12 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -58,16 +58,12 @@ jobs: - name: Run ${{ matrix.version.distribution }} integration tests id: test-execution run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - - - name: Scrape Metrics - run: | - bash scripts/scrape-metrics.sh -t es-${{ matrix.version }} - name: Upload Metrics Artifact uses: actions/upload-artifact@v3 with: name: es-metrics-${{ matrix.version }} - path: ./metrics/es-${{ matrix.version }}_metrics.txt + path: ./metrics/es_metrics.txt retention-days: 7 - name: Upload coverage to codecov diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index a6c8b8296b6..ea6290ba918 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -130,6 +130,9 @@ main() { build_local_img if [[ "${j_version}" == "v2" ]]; then STORAGE=${distro} SPAN_STORAGE_TYPE=${distro} make jaeger-v2-storage-integration-test + chmod +x ./scripts/scrape-metrics.sh + ./scripts/scrape-metrics.sh -t es + elif [[ "${j_version}" == "v1" ]]; then STORAGE=${distro} make storage-integration-test make index-cleaner-integration-test diff --git a/scripts/scrape-metrics.sh b/scripts/scrape-metrics.sh old mode 100644 new mode 100755 index cce8a7c7a19..2183170fc91 --- a/scripts/scrape-metrics.sh +++ b/scripts/scrape-metrics.sh @@ -49,7 +49,7 @@ scrape_metrics() { exit 1 fi - if ! curl -s "http://localhost:$port/metrics" > "$output_file"; then + if ! curl "http://jaeger-collector:$port/metrics" > "$output_file"; then echo "Failed to scrape metrics for $test_type from port $port" exit 1 fi From 5170c8e09f6fbbd0a85acffb451beeaf03b6ee5e Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 14 Dec 2024 04:25:40 +0530 Subject: [PATCH 06/53] changes Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-badger.yaml | 6 +----- .github/workflows/ci-e2e-cassandra.yml | 8 ++------ .github/workflows/ci-e2e-elasticsearch.yml | 4 ++-- .github/workflows/ci-e2e-grpc.yml | 6 +----- .github/workflows/ci-e2e-kafka.yml | 6 +----- .github/workflows/ci-e2e-memory.yaml | 6 +----- .github/workflows/ci-e2e-opensearch.yml | 6 +----- .../internal/integration/e2e_integration.go | 8 ++++++++ scripts/es-integration-test.sh | 2 -- scripts/scrape-metrics.sh | 20 +++++++++++++++---- 10 files changed, 33 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index cd374d267a6..005c6b5dab8 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -40,16 +40,12 @@ jobs: STORAGE=badger make jaeger-v2-storage-integration-test ;; esac - - - name: Scrape Metrics - run: | - bash scripts/scrape-metrics.sh -t badger-${{ matrix.version }} - name: Upload Metrics Artifact uses: actions/upload-artifact@v3 with: name: badger-metrics-${{ matrix.version }} - path: ./metrics/badger-${{ matrix.version }}_metrics.txt + path: ./metrics/badger_metrics.txt retention-days: 7 - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index f16b9f4baa6..0c95f9e4522 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -48,16 +48,12 @@ jobs: run: bash scripts/cassandra-integration-test.sh ${{ matrix.version.major }} ${{ matrix.version.schema }} ${{ matrix.jaeger-version }} env: SKIP_APPLY_SCHEMA: ${{ matrix.create-schema == 'auto' && true || false }} - - - name: Scrape Metrics - run: | - bash scripts/scrape-metrics.sh -t cassandra-${{ matrix.version }} - + - name: Upload Metrics Artifact uses: actions/upload-artifact@v3 with: name: cassandra-metrics-${{ matrix.version }} - path: ./metrics/cassandra-${{ matrix.version }}_metrics.txt + path: ./metrics/cassandra_metrics.txt retention-days: 7 - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 8bd413e6c12..a2a1bbb0707 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -62,8 +62,8 @@ jobs: - name: Upload Metrics Artifact uses: actions/upload-artifact@v3 with: - name: es-metrics-${{ matrix.version }} - path: ./metrics/es_metrics.txt + name: elasticsearch-metrics-${{ matrix.version }} + path: ./metrics/elasticsearch_metrics.txt retention-days: 7 - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 73cf8982cf5..6646b89917c 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -40,16 +40,12 @@ jobs: STORAGE=grpc SPAN_STORAGE_TYPE=memory make jaeger-v2-storage-integration-test ;; esac - - - name: Scrape Metrics - run: | - bash scripts/scrape-metrics.sh -t grpc-${{ matrix.version }} - name: Upload Metrics Artifact uses: actions/upload-artifact@v3 with: name: grpc-metrics-${{ matrix.version }} - path: ./metrics/grpc-${{ matrix.version }}_metrics.txt + path: ./metrics/grpc_metrics.txt retention-days: 7 - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 2ddf0b7694a..c5ef0ae44e7 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -34,16 +34,12 @@ jobs: - name: Run Kafka integration tests id: test-execution run: bash scripts/kafka-integration-test.sh -j ${{ matrix.jaeger-version }} - - - name: Scrape Metrics - run: | - bash scripts/scrape-metrics.sh -t kafka-${{ matrix.version }} - name: Upload Metrics Artifact uses: actions/upload-artifact@v3 with: name: kafka-metrics-${{ matrix.version }} - path: ./metrics/kafka-${{ matrix.version }}_metrics.txt + path: ./metrics/kafka_metrics.txt retention-days: 7 - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index eac3f13c26f..62cc363c9fa 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -30,15 +30,11 @@ jobs: run: | STORAGE=memory_v2 make jaeger-v2-storage-integration-test - - name: Scrape Metrics - run: | - bash scripts/scrape-metrics.sh -t memory-${{ matrix.version }} - - name: Upload Metrics Artifact uses: actions/upload-artifact@v3 with: name: memory-metrics-${{ matrix.version }} - path: ./metrics/memory-${{ matrix.version }}_metrics.txt + path: ./metrics/memory_metrics.txt retention-days: 7 - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index ede2760857f..5203aab941d 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -52,15 +52,11 @@ jobs: id: test-execution run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - - name: Scrape Metrics - run: | - bash scripts/scrape-metrics.sh -t opensearch-${{ matrix.version }} - - name: Upload Metrics Artifact uses: actions/upload-artifact@v3 with: name: opensearch-metrics-${{ matrix.version }} - path: ./metrics/opensearch-${{ matrix.version }}_metrics.txt + path: ./metrics/opensearch_metrics.txt retention-days: 7 - name: Upload coverage to codecov diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index c8681e4ed7e..69eb614bbf1 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -152,6 +152,14 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) { s.SpanReader, err = createSpanReader(logger, ports.QueryGRPC) require.NoError(t, err) + scrapeCmd := exec.Command("./scripts/scrape-metrics.sh", "-t", storage) + scrapeCmd.Dir = "../../../.." + output, err := scrapeCmd.CombinedOutput() + if err != nil { + t.Errorf("Failed to scrape metrics: %v", err) + t.Log(string(output)) + } + t.Cleanup(func() { // Call e2eCleanUp to close the SpanReader and SpanWriter gRPC connection. s.e2eCleanUp(t) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index ea6290ba918..e5eaf4e2b5f 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -130,8 +130,6 @@ main() { build_local_img if [[ "${j_version}" == "v2" ]]; then STORAGE=${distro} SPAN_STORAGE_TYPE=${distro} make jaeger-v2-storage-integration-test - chmod +x ./scripts/scrape-metrics.sh - ./scripts/scrape-metrics.sh -t es elif [[ "${j_version}" == "v1" ]]; then STORAGE=${distro} make storage-integration-test diff --git a/scripts/scrape-metrics.sh b/scripts/scrape-metrics.sh index 2183170fc91..5b102825598 100755 --- a/scripts/scrape-metrics.sh +++ b/scripts/scrape-metrics.sh @@ -15,6 +15,8 @@ print_help() { test_type="" port=8888 +MAX_ATTEMPTS=30 +WAIT_TIME=2 output_dir="./metrics" # Parse arguments @@ -40,6 +42,7 @@ scrape_metrics() { local test_type=$1 local port=$2 local output_file="${output_dir}/${test_type}_metrics.txt" + local attempts=0 # Create output directory if it doesn't exist mkdir -p "$output_dir" @@ -49,11 +52,20 @@ scrape_metrics() { exit 1 fi - if ! curl "http://jaeger-collector:$port/metrics" > "$output_file"; then - echo "Failed to scrape metrics for $test_type from port $port" - exit 1 - fi + while [ $attempts -lt $MAX_ATTEMPTS ]; do + + if curl -sf http://localhost:${port}/metrics > /dev/null; then + echo "Successfully connected to metrics endpoint at port ${port}" + curl -s http://localhost:${port}/metrics > "$output_file" + echo "Metrics saved to jaeger_metrics.txt" + return 0 + else + echo "Attempt $((attempts + 1))/${MAX_ATTEMPTS}: Connection to metrics endpoint failed" + attempts=$((attempts + 1)) + sleep $WAIT_TIME + fi + done echo "Metrics for $test_type saved to $output_file" } From a3d32525d51beceb8d23b23d6f6558346888bb86 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 14 Dec 2024 04:41:37 +0530 Subject: [PATCH 07/53] shell lint Signed-off-by: chahatsagarmain --- scripts/scrape-metrics.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/scrape-metrics.sh b/scripts/scrape-metrics.sh index 5b102825598..ef42874549b 100755 --- a/scripts/scrape-metrics.sh +++ b/scripts/scrape-metrics.sh @@ -54,10 +54,10 @@ scrape_metrics() { while [ $attempts -lt $MAX_ATTEMPTS ]; do - if curl -sf http://localhost:${port}/metrics > /dev/null; then + if curl -sf http://localhost:"${port}"/metrics > /dev/null; then echo "Successfully connected to metrics endpoint at port ${port}" - curl -s http://localhost:${port}/metrics > "$output_file" + curl -s http://localhost:"${port}"/metrics > "$output_file" echo "Metrics saved to jaeger_metrics.txt" return 0 else From b0ef4d4efdabeefed5074d2bde5c795e4d9f5eb0 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 14 Dec 2024 07:29:31 +0530 Subject: [PATCH 08/53] minor changes Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-all.yml | 2 +- .github/workflows/ci-e2e-badger.yaml | 5 ++-- .github/workflows/ci-e2e-cassandra.yml | 5 ++-- .github/workflows/ci-e2e-elasticsearch.yml | 5 ++-- .github/workflows/ci-e2e-grpc.yml | 5 ++-- .github/workflows/ci-e2e-kafka.yml | 7 +++--- .github/workflows/ci-e2e-memory.yaml | 6 ++--- .github/workflows/ci-e2e-opensearch.yml | 7 +++--- .gitignore | 1 + .../internal/integration/e2e_integration.go | 24 +++++++++++++++---- scripts/es-integration-test.sh | 1 - 11 files changed, 44 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci-e2e-all.yml b/.github/workflows/ci-e2e-all.yml index 6ab16de928c..082270f5488 100644 --- a/.github/workflows/ci-e2e-all.yml +++ b/.github/workflows/ci-e2e-all.yml @@ -1,4 +1,4 @@ -name: E2E Tests with meti +name: E2E Tests on: push: diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 005c6b5dab8..56639bb6e7f 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -42,11 +42,12 @@ jobs: esac - name: Upload Metrics Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 + if: ${{ matrix.version }} == "v2" with: name: badger-metrics-${{ matrix.version }} path: ./metrics/badger_metrics.txt - retention-days: 7 + retention-days: 60 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 0c95f9e4522..fb801184523 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -50,11 +50,12 @@ jobs: SKIP_APPLY_SCHEMA: ${{ matrix.create-schema == 'auto' && true || false }} - name: Upload Metrics Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 + if: ${{ matrix.jaeger-version }} == "v2" with: name: cassandra-metrics-${{ matrix.version }} path: ./metrics/cassandra_metrics.txt - retention-days: 7 + retention-days: 60 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index a2a1bbb0707..089775b90ad 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -60,11 +60,12 @@ jobs: run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - name: Upload Metrics Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 + if: ${{ matrix.version.jaeger }} == "v2" with: name: elasticsearch-metrics-${{ matrix.version }} path: ./metrics/elasticsearch_metrics.txt - retention-days: 7 + retention-days: 60 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 6646b89917c..3a6228f358b 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -42,11 +42,12 @@ jobs: esac - name: Upload Metrics Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 + if: ${{ matrix.version }} == "v2" with: name: grpc-metrics-${{ matrix.version }} path: ./metrics/grpc_metrics.txt - retention-days: 7 + retention-days: 60 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index c5ef0ae44e7..924c505bf3c 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -36,11 +36,12 @@ jobs: run: bash scripts/kafka-integration-test.sh -j ${{ matrix.jaeger-version }} - name: Upload Metrics Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 + if: ${{ matrix.jaeger-version }} == "v2" with: - name: kafka-metrics-${{ matrix.version }} + name: kafka-metrics-${{ matrix.jaeger-version }} path: ./metrics/kafka_metrics.txt - retention-days: 7 + retention-days: 60 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 62cc363c9fa..06555e90372 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -31,11 +31,11 @@ jobs: STORAGE=memory_v2 make jaeger-v2-storage-integration-test - name: Upload Metrics Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: memory-metrics-${{ matrix.version }} + name: memory-metrics path: ./metrics/memory_metrics.txt - retention-days: 7 + retention-days: 60 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 5203aab941d..dc9bb0e7a94 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -53,11 +53,12 @@ jobs: run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - name: Upload Metrics Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 + if: ${{ matrix.version.major }} == "v2" with: - name: opensearch-metrics-${{ matrix.version }} + name: opensearch-metrics-${{ matrix.version.jaeger }} path: ./metrics/opensearch_metrics.txt - retention-days: 7 + retention-days: 60 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.gitignore b/.gitignore index e8719d8386d..824dfce4cbe 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ sha256sum.combined.txt resource.syso .gocache test-results.json +metrics/ \ No newline at end of file diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index 69eb614bbf1..16dd5e9cc77 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -152,14 +152,28 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) { s.SpanReader, err = createSpanReader(logger, ports.QueryGRPC) require.NoError(t, err) - scrapeCmd := exec.Command("./scripts/scrape-metrics.sh", "-t", storage) - scrapeCmd.Dir = "../../../.." - output, err := scrapeCmd.CombinedOutput() + req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://localhost:8888/metrics", nil) + require.NoError(t, err) + + client := &http.Client{} + resp, err := client.Do(req) + require.NoError(t, err) + defer resp.Body.Close() + + err = os.MkdirAll("../../../../metrics", os.ModePerm) if err != nil { - t.Errorf("Failed to scrape metrics: %v", err) - t.Log(string(output)) + t.Fatalf("Failed to create directory: %v", err) } + metricsFile, err := os.Create(fmt.Sprintf("../../../../metrics/%v_metrics.txt", storage)) + if err != nil { + t.Fatalf("Failed to create metrics file: %v", err) + } + defer metricsFile.Close() + + _, err = io.Copy(metricsFile, resp.Body) + require.NoError(t, err) + t.Cleanup(func() { // Call e2eCleanUp to close the SpanReader and SpanWriter gRPC connection. s.e2eCleanUp(t) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index e5eaf4e2b5f..a6c8b8296b6 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -130,7 +130,6 @@ main() { build_local_img if [[ "${j_version}" == "v2" ]]; then STORAGE=${distro} SPAN_STORAGE_TYPE=${distro} make jaeger-v2-storage-integration-test - elif [[ "${j_version}" == "v1" ]]; then STORAGE=${distro} make storage-integration-test make index-cleaner-integration-test From 2244ea97582929247d3f324339185cb7b918aed7 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 16 Dec 2024 00:33:50 +0530 Subject: [PATCH 09/53] reviewed changes Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-badger.yaml | 2 +- .github/workflows/ci-e2e-cassandra.yml | 6 +- .github/workflows/ci-e2e-elasticsearch.yml | 4 +- .github/workflows/ci-e2e-grpc.yml | 2 +- .github/workflows/ci-e2e-kafka.yml | 2 +- .github/workflows/ci-e2e-memory.yaml | 2 +- .github/workflows/ci-e2e-opensearch.yml | 2 +- .../internal/integration/e2e_integration.go | 47 +++++------ scripts/scrape-metrics.sh | 78 ------------------- 9 files changed, 35 insertions(+), 110 deletions(-) delete mode 100755 scripts/scrape-metrics.sh diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 56639bb6e7f..25f0af55663 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -47,7 +47,7 @@ jobs: with: name: badger-metrics-${{ matrix.version }} path: ./metrics/badger_metrics.txt - retention-days: 60 + retention-days: 7 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index fb801184523..92633513517 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -53,9 +53,9 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.jaeger-version }} == "v2" with: - name: cassandra-metrics-${{ matrix.version }} - path: ./metrics/cassandra_metrics.txt - retention-days: 60 + name: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }} + path: ./metrics/cassandra_metrics.txt + retention-days: 7 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 089775b90ad..0925d610456 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -63,9 +63,9 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.version.jaeger }} == "v2" with: - name: elasticsearch-metrics-${{ matrix.version }} + name: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}} path: ./metrics/elasticsearch_metrics.txt - retention-days: 60 + retention-days: 7 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 3a6228f358b..ca7decad0f0 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -47,7 +47,7 @@ jobs: with: name: grpc-metrics-${{ matrix.version }} path: ./metrics/grpc_metrics.txt - retention-days: 60 + retention-days: 7 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 924c505bf3c..84e7bc9385a 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -41,7 +41,7 @@ jobs: with: name: kafka-metrics-${{ matrix.jaeger-version }} path: ./metrics/kafka_metrics.txt - retention-days: 60 + retention-days: 7 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 06555e90372..8af51124da3 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -35,7 +35,7 @@ jobs: with: name: memory-metrics path: ./metrics/memory_metrics.txt - retention-days: 60 + retention-days: 7 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index dc9bb0e7a94..e289e79db31 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -58,7 +58,7 @@ jobs: with: name: opensearch-metrics-${{ matrix.version.jaeger }} path: ./metrics/opensearch_metrics.txt - retention-days: 60 + retention-days: 7 - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index 16dd5e9cc77..330307b351d 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -152,29 +152,8 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) { s.SpanReader, err = createSpanReader(logger, ports.QueryGRPC) require.NoError(t, err) - req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://localhost:8888/metrics", nil) - require.NoError(t, err) - - client := &http.Client{} - resp, err := client.Do(req) - require.NoError(t, err) - defer resp.Body.Close() - - err = os.MkdirAll("../../../../metrics", os.ModePerm) - if err != nil { - t.Fatalf("Failed to create directory: %v", err) - } - - metricsFile, err := os.Create(fmt.Sprintf("../../../../metrics/%v_metrics.txt", storage)) - if err != nil { - t.Fatalf("Failed to create metrics file: %v", err) - } - defer metricsFile.Close() - - _, err = io.Copy(metricsFile, resp.Body) - require.NoError(t, err) - t.Cleanup(func() { + scrapeMetrics(t, storage) // Call e2eCleanUp to close the SpanReader and SpanWriter gRPC connection. s.e2eCleanUp(t) }) @@ -233,6 +212,30 @@ func (s *E2EStorageIntegration) e2eCleanUp(t *testing.T) { require.NoError(t, s.SpanWriter.(io.Closer).Close()) } +func scrapeMetrics(t *testing.T, storage string) { + req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://localhost:8888/metrics", nil) + require.NoError(t, err) + + client := &http.Client{} + resp, err := client.Do(req) + require.NoError(t, err) + defer resp.Body.Close() + + err = os.MkdirAll("../../../../metrics", os.ModePerm) + if err != nil { + t.Fatalf("Failed to create directory: %v", err) + } + + metricsFile, err := os.Create(fmt.Sprintf("../../../../metrics/%v_metrics.txt", storage)) + if err != nil { + t.Fatalf("Failed to create metrics file: %v", err) + } + defer metricsFile.Close() + + _, err = io.Copy(metricsFile, resp.Body) + require.NoError(t, err) +} + func createStorageCleanerConfig(t *testing.T, configFile string, storage string) string { data, err := os.ReadFile(configFile) require.NoError(t, err) diff --git a/scripts/scrape-metrics.sh b/scripts/scrape-metrics.sh deleted file mode 100755 index ef42874549b..00000000000 --- a/scripts/scrape-metrics.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2024 The Jaeger Authors. -# SPDX-License-Identifier: Apache-2.0 - -set -euf -o pipefail - -print_help() { - echo "Usage: $0 [-t test_type] [-p port] [-o output directory]" - echo " -t: Test type (badger, cassandra, etc.)" - echo " -p: Metrics port (default: 8888)" - echo " -o: Output directory for metrics files" - exit 1 -} - -test_type="" -port=8888 -MAX_ATTEMPTS=30 -WAIT_TIME=2 -output_dir="./metrics" - -# Parse arguments -while getopts "t:p:o:" opt; do - case "${opt}" in - t) - test_type="${OPTARG}" - ;; - p) - port="${OPTARG}" - ;; - o) - output_dir="${OPTARG}" - ;; - ?) - print_help - ;; - esac -done - -# Metrics scraping function -scrape_metrics() { - local test_type=$1 - local port=$2 - local output_file="${output_dir}/${test_type}_metrics.txt" - local attempts=0 - - # Create output directory if it doesn't exist - mkdir -p "$output_dir" - - if [ -z "$test_type" ]; then - echo "Test type is required" - exit 1 - fi - - while [ $attempts -lt $MAX_ATTEMPTS ]; do - - if curl -sf http://localhost:"${port}"/metrics > /dev/null; then - echo "Successfully connected to metrics endpoint at port ${port}" - - curl -s http://localhost:"${port}"/metrics > "$output_file" - echo "Metrics saved to jaeger_metrics.txt" - return 0 - else - echo "Attempt $((attempts + 1))/${MAX_ATTEMPTS}: Connection to metrics endpoint failed" - attempts=$((attempts + 1)) - sleep $WAIT_TIME - fi - done - echo "Metrics for $test_type saved to $output_file" -} - -if [ -z "$test_type" ]; then - echo "Test type is required" - print_help -fi - -# Scrape metrics -scrape_metrics "$test_type" "$port" \ No newline at end of file From 283bc5c2df1ba2a3be50a6d00af5b9cec27cfdff Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 29 Dec 2024 01:48:55 +0530 Subject: [PATCH 10/53] added cache save Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-badger.yaml | 14 +++++++++++--- .github/workflows/ci-e2e-cassandra.yml | 15 ++++++++++++--- .github/workflows/ci-e2e-elasticsearch.yml | 13 ++++++++++--- .github/workflows/ci-e2e-grpc.yml | 13 ++++++++++--- .github/workflows/ci-e2e-kafka.yml | 13 ++++++++++--- .github/workflows/ci-e2e-memory.yaml | 9 ++++++++- .github/workflows/ci-e2e-opensearch.yml | 13 ++++++++++--- .gitignore | 2 +- .../internal/integration/e2e_integration.go | 12 ++++-------- 9 files changed, 76 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 25f0af55663..308cd9ea38d 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -45,9 +45,17 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.version }} == "v2" with: - name: badger-metrics-${{ matrix.version }} - path: ./metrics/badger_metrics.txt - retention-days: 7 + name: badger-metrics-${{ matrix.version }} + path: ./.metrics/badger_metrics.txt + retention-days: 7 + + - name: Release Action then cache + uses: actions/cache@v4 + if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.version }} == "v2" + with: + path: ./.metrics/badger_metrics.txt + key: ${{ github.ref }}_badger_metrics + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 92633513517..769601173a0 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -53,12 +53,21 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.jaeger-version }} == "v2" with: - name: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }} - path: ./metrics/cassandra_metrics.txt - retention-days: 7 + name: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }} + path: ./.metrics/cassandra_metrics.txt + retention-days: 7 + + - name: Release Action then cache + if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.jaeger-version }} == "v2" + uses: actions/cache@v4 + with: + path: ./.metrics/cassandra_metrics.txt + key: ${{ github.ref }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: files: cover.out flags: cassandra-${{ matrix.version.major }}-${{ matrix.jaeger-version }}-${{ matrix.create-schema }} + + diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 0925d610456..79df5256326 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -63,9 +63,16 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.version.jaeger }} == "v2" with: - name: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}} - path: ./metrics/elasticsearch_metrics.txt - retention-days: 7 + name: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}} + path: ./.metrics/elasticsearch_metrics.txt + retention-days: 7 + + - name: Release Action then cache + uses: actions/cache@v4 + if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.version.jaeger }} == "v2" + with: + path: ./.metrics/elasticsearch_metrics.txt + key: ${{ github.ref }}_elasticsearch_${{ matrix.version.major }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index ca7decad0f0..7ade49c0da5 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -45,9 +45,16 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.version }} == "v2" with: - name: grpc-metrics-${{ matrix.version }} - path: ./metrics/grpc_metrics.txt - retention-days: 7 + name: grpc-metrics-${{ matrix.version }} + path: ./.metrics/grpc_metrics.txt + retention-days: 7 + + - name: Release Action then cache + uses: actions/cache@v4 + if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.version }} == "v2" + with: + path: ./.metrics/grpc_metrics.txt + key: ${{ github.ref }}_grpc_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 84e7bc9385a..c78d2915daa 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -39,9 +39,16 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.jaeger-version }} == "v2" with: - name: kafka-metrics-${{ matrix.jaeger-version }} - path: ./metrics/kafka_metrics.txt - retention-days: 7 + name: kafka-metrics-${{ matrix.jaeger-version }} + path: ./.metrics/kafka_metrics.txt + retention-days: 7 + + - name: Release Action then cache + uses: actions/cache@v4 + if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.jaeger-version }} == "v2" + with: + path: ./.metrics/kafka_metrics.txt + key: ${{ github.ref }}_kafka_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 8af51124da3..32d68d8fa29 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -34,8 +34,15 @@ jobs: uses: actions/upload-artifact@v4 with: name: memory-metrics - path: ./metrics/memory_metrics.txt + path: ./.metrics/memory_metrics.txt retention-days: 7 + + - name: Release Action then cache + uses: actions/cache@v4 + if: startsWith(github.ref, 'refs/tags/') + with: + path: ./.metrics/memory_metrics.txt + key: ${{ github.ref }}_memory_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index e289e79db31..1e26df7e4d7 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -54,12 +54,19 @@ jobs: - name: Upload Metrics Artifact uses: actions/upload-artifact@v4 - if: ${{ matrix.version.major }} == "v2" + if: ${{ matrix.version.jaeger }} == "v2" with: - name: opensearch-metrics-${{ matrix.version.jaeger }} - path: ./metrics/opensearch_metrics.txt + name: opensearch-metrics-${{ matrix.version.major }} + path: ./.metrics/opensearch_metrics.txt retention-days: 7 + - name: Release Action then cache + uses: actions/cache@v4 + if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.version.jaeger }} == "v2" + with: + path: ./.metrics/opensearch_metrics.txt + key: ${{ github.ref }}_kafka_metrics_${{ matrix.version.major }} + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.gitignore b/.gitignore index 824dfce4cbe..95bc230a2d3 100644 --- a/.gitignore +++ b/.gitignore @@ -50,4 +50,4 @@ sha256sum.combined.txt resource.syso .gocache test-results.json -metrics/ \ No newline at end of file +.metrics/ \ No newline at end of file diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index 330307b351d..8d5311a30d1 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -221,15 +221,11 @@ func scrapeMetrics(t *testing.T, storage string) { require.NoError(t, err) defer resp.Body.Close() - err = os.MkdirAll("../../../../metrics", os.ModePerm) - if err != nil { - t.Fatalf("Failed to create directory: %v", err) - } + outputDir := "../../../../.metrics" + require.NoError(t, os.MkdirAll(outputDir, os.ModePerm)) - metricsFile, err := os.Create(fmt.Sprintf("../../../../metrics/%v_metrics.txt", storage)) - if err != nil { - t.Fatalf("Failed to create metrics file: %v", err) - } + metricsFile, err := os.Create(fmt.Sprintf("%s/%v_metrics.txt", outputDir, storage)) + require.NoError(t, err) defer metricsFile.Close() _, err = io.Copy(metricsFile, resp.Body) From 6adf944126ca95aa6dfeb25e2e03e528a6144c87 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 29 Dec 2024 02:23:18 +0530 Subject: [PATCH 11/53] fixes Signed-off-by: chahatsagarmain --- .../internal/integration/e2e_integration.go | 48 +------------------ 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index 159e01f2104..0240d1f83ac 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -104,56 +104,10 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) { }) } -func (s *E2EStorageIntegration) doHealthCheck(t *testing.T) bool { - healthCheckPort := s.HealthCheckPort - if healthCheckPort == 0 { - healthCheckPort = ports.CollectorV2HealthChecks - } - healthCheckEndpoint := fmt.Sprintf("http://localhost:%d/status", healthCheckPort) - t.Logf("Checking if %s is available on %s", s.BinaryName, healthCheckEndpoint) - ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) - defer cancel() - req, err := http.NewRequestWithContext(ctx, http.MethodGet, healthCheckEndpoint, nil) - if err != nil { - t.Logf("HTTP request creation failed: %v", err) - return false - } - resp, err := http.DefaultClient.Do(req) - if err != nil { - t.Logf("HTTP request failed: %v", err) - return false - } - defer resp.Body.Close() - body, err := io.ReadAll(resp.Body) - if err != nil { - t.Logf("Failed to read HTTP response body: %v", err) - return false - } - if resp.StatusCode != http.StatusOK { - t.Logf("HTTP response not OK: %v", string(body)) - return false - } - - var healthResponse struct { - Status string `json:"status"` - } - if err := json.NewDecoder(bytes.NewReader(body)).Decode(&healthResponse); err != nil { - t.Logf("Failed to decode JSON response '%s': %v", string(body), err) - return false - } - - // Check if the status field in the JSON is "StatusOK" - if healthResponse.Status != "StatusOK" { - t.Logf("Received non-OK status %s: %s", healthResponse.Status, string(body)) - return false - } - return true -} - // e2eCleanUp closes the SpanReader and SpanWriter gRPC connection. // This function should be called after all the tests are finished. func (s *E2EStorageIntegration) e2eCleanUp(t *testing.T) { - require.NoError(t, s.SpanReader.(io.Closer).Close()) + require.NoError(t, s.TraceReader.(io.Closer).Close()) require.NoError(t, s.SpanWriter.(io.Closer).Close()) } From c6703b6782b9474b41346d72ccd01010f0184a8c Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 29 Dec 2024 02:39:47 +0530 Subject: [PATCH 12/53] add schema in key Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-cassandra.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 769601173a0..9a66cd7f93a 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -53,7 +53,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.jaeger-version }} == "v2" with: - name: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }} + name: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }} path: ./.metrics/cassandra_metrics.txt retention-days: 7 From adbe80fd8f0044ba23e1e288f598c5538bd67a00 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 29 Dec 2024 03:25:46 +0530 Subject: [PATCH 13/53] test ci Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-cassandra.yml | 2 +- cmd/jaeger/internal/integration/e2e_integration.go | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 9a66cd7f93a..0e439c6742f 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -58,7 +58,7 @@ jobs: retention-days: 7 - name: Release Action then cache - if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.jaeger-version }} == "v2" + if: contains(github.ref, 'refs/tags/') && ${{ matrix.jaeger-version }} == "v2" uses: actions/cache@v4 with: path: ./.metrics/cassandra_metrics.txt diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index 0240d1f83ac..e83e6b61cc3 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -99,18 +99,11 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) { t.Cleanup(func() { scrapeMetrics(t, storage) - // Call e2eCleanUp to close the SpanReader and SpanWriter gRPC connection. - s.e2eCleanUp(t) + require.NoError(t, s.TraceReader.(io.Closer).Close()) + require.NoError(t, s.SpanWriter.(io.Closer).Close()) }) } -// e2eCleanUp closes the SpanReader and SpanWriter gRPC connection. -// This function should be called after all the tests are finished. -func (s *E2EStorageIntegration) e2eCleanUp(t *testing.T) { - require.NoError(t, s.TraceReader.(io.Closer).Close()) - require.NoError(t, s.SpanWriter.(io.Closer).Close()) -} - func scrapeMetrics(t *testing.T, storage string) { req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://localhost:8888/metrics", nil) require.NoError(t, err) From d46316ba4d917126caea20f944a0ce8b04bf2f85 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 29 Dec 2024 22:48:14 +0530 Subject: [PATCH 14/53] test ci Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-badger.yaml | 2 +- .github/workflows/ci-e2e-cassandra.yml | 9 +++++++-- .github/workflows/ci-e2e-elasticsearch.yml | 2 +- .github/workflows/ci-e2e-grpc.yml | 2 +- .github/workflows/ci-e2e-kafka.yml | 2 +- .github/workflows/ci-e2e-memory.yaml | 2 +- .github/workflows/ci-e2e-opensearch.yml | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 308cd9ea38d..db5cbe05b3d 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -45,7 +45,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.version }} == "v2" with: - name: badger-metrics-${{ matrix.version }} + name: badger-metrics-${{ matrix.version }}.txt path: ./.metrics/badger_metrics.txt retention-days: 7 diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 0e439c6742f..30ebfc86e8a 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -53,16 +53,21 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.jaeger-version }} == "v2" with: - name: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }} + name: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}.txt path: ./.metrics/cassandra_metrics.txt retention-days: 7 - name: Release Action then cache - if: contains(github.ref, 'refs/tags/') && ${{ matrix.jaeger-version }} == "v2" + if: contains(github.ref,'tags') && ${{ matrix.jaeger-version }} == "v2" uses: actions/cache@v4 with: path: ./.metrics/cassandra_metrics.txt key: ${{ github.ref }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} + + - name: testing + if: contains(github.ref, 'tags') + run: echo "I only run if the branch has release in its name!" + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 79df5256326..a94e5c8544a 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -63,7 +63,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.version.jaeger }} == "v2" with: - name: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}} + name: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}}.txt path: ./.metrics/elasticsearch_metrics.txt retention-days: 7 diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 7ade49c0da5..ef9a6fd60e5 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -45,7 +45,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.version }} == "v2" with: - name: grpc-metrics-${{ matrix.version }} + name: grpc-metrics-${{ matrix.version }}.txt path: ./.metrics/grpc_metrics.txt retention-days: 7 diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 1a90f68afe7..13ae2061095 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -40,7 +40,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.jaeger-version }} == "v2" with: - name: kafka-metrics-${{ matrix.jaeger-version }} + name: kafka-metrics-${{ matrix.jaeger-version }}.txt path: ./.metrics/kafka_metrics.txt retention-days: 7 diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 32d68d8fa29..b21cc45c2e4 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -33,7 +33,7 @@ jobs: - name: Upload Metrics Artifact uses: actions/upload-artifact@v4 with: - name: memory-metrics + name: memory-metrics.txt path: ./.metrics/memory_metrics.txt retention-days: 7 diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 1e26df7e4d7..a0dcf6d3a5d 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -56,7 +56,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ matrix.version.jaeger }} == "v2" with: - name: opensearch-metrics-${{ matrix.version.major }} + name: opensearch-metrics-${{ matrix.version.major }}.txt path: ./.metrics/opensearch_metrics.txt retention-days: 7 From 0da4dbb4651c8f82a454c89c193d0c8efc9e5d2f Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 30 Dec 2024 01:48:42 +0530 Subject: [PATCH 15/53] minor changes Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-badger.yaml | 6 +++--- .github/workflows/ci-e2e-cassandra.yml | 21 ++++++++++++++------- .github/workflows/ci-e2e-elasticsearch.yml | 6 +++--- .github/workflows/ci-e2e-grpc.yml | 6 +++--- .github/workflows/ci-e2e-kafka.yml | 6 +++--- .github/workflows/ci-e2e-memory.yaml | 6 +++--- .github/workflows/ci-e2e-opensearch.yml | 4 ++-- 7 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index db5cbe05b3d..f8269dc3c60 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -49,12 +49,12 @@ jobs: path: ./.metrics/badger_metrics.txt retention-days: 7 - - name: Release Action then cache + - name: Cache scraped metrics for tagged release for longer retention uses: actions/cache@v4 - if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.version }} == "v2" + if: contains(github.ref,'tags') && ${{ matrix.version }} == "v2" with: path: ./.metrics/badger_metrics.txt - key: ${{ github.ref }}_badger_metrics + key: ${{ github.ref_name }}_badger_metrics - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 30ebfc86e8a..610aedcfc6a 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -57,17 +57,24 @@ jobs: path: ./.metrics/cassandra_metrics.txt retention-days: 7 - - name: Release Action then cache + - name: Cache scraped metrics for tagged release for longer retention if: contains(github.ref,'tags') && ${{ matrix.jaeger-version }} == "v2" uses: actions/cache@v4 with: path: ./.metrics/cassandra_metrics.txt - key: ${{ github.ref }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - - - name: testing - if: contains(github.ref, 'tags') - run: echo "I only run if the branch has release in its name!" - + key: ${{ github.ref_name }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} + + - name: Restore and test cache download + if: ${{ matrix.jaeger-version }} == "v2" + id: get-v2-tag + run: | + echo "v2_tag=$(make echo-v2)" >> $GITHUB_ENV + echo "v2_tag=${{ env.v2_tag }}" + + - uses: actions/cache@v4 + with: + path: ./.metrics/cassandra_metrics.txt + key: ${{ env.v2_tag }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index a94e5c8544a..0934542bc15 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -67,12 +67,12 @@ jobs: path: ./.metrics/elasticsearch_metrics.txt retention-days: 7 - - name: Release Action then cache + - name: Cache scraped metrics for tagged release for longer retention uses: actions/cache@v4 - if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.version.jaeger }} == "v2" + if: contains(github.ref,'tags') && ${{ matrix.version.jaeger }} == "v2" with: path: ./.metrics/elasticsearch_metrics.txt - key: ${{ github.ref }}_elasticsearch_${{ matrix.version.major }} + key: ${{ github.ref_name }}_elasticsearch_${{ matrix.version.major }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index ef9a6fd60e5..56e9a6cb2eb 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -49,12 +49,12 @@ jobs: path: ./.metrics/grpc_metrics.txt retention-days: 7 - - name: Release Action then cache + - name: Cache scraped metrics for tagged release for longer retention uses: actions/cache@v4 - if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.version }} == "v2" + if: contains(github.ref,'tags') && ${{ matrix.version }} == "v2" with: path: ./.metrics/grpc_metrics.txt - key: ${{ github.ref }}_grpc_metrics + key: ${{ github.ref_name }}_grpc_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 13ae2061095..991817064ad 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -44,12 +44,12 @@ jobs: path: ./.metrics/kafka_metrics.txt retention-days: 7 - - name: Release Action then cache + - name: Cache scraped metrics for tagged release for longer retention uses: actions/cache@v4 - if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.jaeger-version }} == "v2" + if: contains(github.ref,'tags') && ${{ matrix.jaeger-version }} == "v2" with: path: ./.metrics/kafka_metrics.txt - key: ${{ github.ref }}_kafka_metrics + key: ${{ github.ref_name }}_kafka_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index b21cc45c2e4..47884064998 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -37,12 +37,12 @@ jobs: path: ./.metrics/memory_metrics.txt retention-days: 7 - - name: Release Action then cache + - name: Cache scraped metrics for tagged release for longer retention uses: actions/cache@v4 - if: startsWith(github.ref, 'refs/tags/') + if: contains(github.ref,'tags') with: path: ./.metrics/memory_metrics.txt - key: ${{ github.ref }}_memory_metrics + key: ${{ github.ref_name }}_memory_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index a0dcf6d3a5d..0109c77260b 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -60,9 +60,9 @@ jobs: path: ./.metrics/opensearch_metrics.txt retention-days: 7 - - name: Release Action then cache + - name: Cache scraped metrics for tagged release for longer retention uses: actions/cache@v4 - if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.version.jaeger }} == "v2" + if: contains(github.ref_name,'tags') && ${{ matrix.version.jaeger }} == "v2" with: path: ./.metrics/opensearch_metrics.txt key: ${{ github.ref }}_kafka_metrics_${{ matrix.version.major }} From a479e7fed5486feb8f698e111058ae4f05e28c2d Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 30 Dec 2024 02:06:39 +0530 Subject: [PATCH 16/53] test ci with fixed expression Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-cassandra.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 610aedcfc6a..50f556f12c4 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -58,7 +58,7 @@ jobs: retention-days: 7 - name: Cache scraped metrics for tagged release for longer retention - if: contains(github.ref,'tags') && ${{ matrix.jaeger-version }} == "v2" + if: ${{ contains(github.ref, 'tags') && matrix.jaeger-version == 'v2' }} uses: actions/cache@v4 with: path: ./.metrics/cassandra_metrics.txt @@ -68,8 +68,9 @@ jobs: if: ${{ matrix.jaeger-version }} == "v2" id: get-v2-tag run: | - echo "v2_tag=$(make echo-v2)" >> $GITHUB_ENV - echo "v2_tag=${{ env.v2_tag }}" + v2_tag=$(make echo-v2)" + echo "v2_tag=$v2_tag" >> $GITHUB_ENV + echo "v2_tag: $v2_tag" - uses: actions/cache@v4 with: From 519104e07abd9359b8a9e36569120f255f0f1ea2 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Wed, 1 Jan 2025 17:01:16 +0530 Subject: [PATCH 17/53] shared action and a happy new yar Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 31 +++++++++++++++++++ .github/workflows/ci-e2e-badger.yaml | 20 ++++-------- .github/workflows/ci-e2e-cassandra.yml | 19 ++++-------- .github/workflows/ci-e2e-elasticsearch.yml | 21 +++++-------- .github/workflows/ci-e2e-grpc.yml | 18 +++-------- .github/workflows/ci-e2e-kafka.yml | 19 ++++-------- .github/workflows/ci-e2e-memory.yaml | 17 +++------- .github/workflows/ci-e2e-opensearch.yml | 17 +++------- 8 files changed, 71 insertions(+), 91 deletions(-) create mode 100644 .github/actions/verify-metrics-snapshot/action.yaml diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml new file mode 100644 index 00000000000..6ce934ca760 --- /dev/null +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -0,0 +1,31 @@ +# Copyright (c) 2023 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + +name: 'Verify Metric Snapshot and Upload Metrics' +description: 'Upload or cache the metrics data after verification' +inputs: + snapshot: + description: 'Path to the metric file' + required: true + artifact_key: + description: 'Artifact key used for uploading and fetching artifacts' + required: true + cache_key: + description: 'Cache key used for uploading and fetching the correct cached metric' + required: true +runs: + using: 'composite' + steps: + - name: Upload Metrics Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.artifact_key }} + path: ${{ inputs.snapshot }} + retention-days: 7 + + - name: Cache scraped metrics for tagged release for longer retention + if: contains(github.ref,'tags') + uses: actions/cache@v4 + with: + path: ${{ inputs.snapshot }} + key: ${{ inputs.cache_key }} \ No newline at end of file diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index f8269dc3c60..d160f28a879 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -40,23 +40,15 @@ jobs: STORAGE=badger make jaeger-v2-storage-integration-test ;; esac - - - name: Upload Metrics Artifact - uses: actions/upload-artifact@v4 + + - name: Metric snapshot (upload or cache metric) + uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version }} == "v2" with: - name: badger-metrics-${{ matrix.version }}.txt - path: ./.metrics/badger_metrics.txt - retention-days: 7 + snapshot: ./.metrics/badger_metrics.txt + artifact_key: badger-metrics-${{ matrix.version }}.txt + cache_key: ${{ github.ref_name }}_badger_metrics - - name: Cache scraped metrics for tagged release for longer retention - uses: actions/cache@v4 - if: contains(github.ref,'tags') && ${{ matrix.version }} == "v2" - with: - path: ./.metrics/badger_metrics.txt - key: ${{ github.ref_name }}_badger_metrics - - - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 50f556f12c4..576e7f42cef 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -49,21 +49,14 @@ jobs: env: SKIP_APPLY_SCHEMA: ${{ matrix.create-schema == 'auto' && true || false }} - - name: Upload Metrics Artifact - uses: actions/upload-artifact@v4 + - name: Metric snapshot (upload or cache metric) + uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.jaeger-version }} == "v2" with: - name: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}.txt - path: ./.metrics/cassandra_metrics.txt - retention-days: 7 + snapshot: ./.metrics/cassandra_metrics.txt + artifact_key: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}.txt + cache_key: ${{ github.ref_name }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - - name: Cache scraped metrics for tagged release for longer retention - if: ${{ contains(github.ref, 'tags') && matrix.jaeger-version == 'v2' }} - uses: actions/cache@v4 - with: - path: ./.metrics/cassandra_metrics.txt - key: ${{ github.ref_name }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - - name: Restore and test cache download if: ${{ matrix.jaeger-version }} == "v2" id: get-v2-tag @@ -75,7 +68,7 @@ jobs: - uses: actions/cache@v4 with: path: ./.metrics/cassandra_metrics.txt - key: ${{ env.v2_tag }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} + key: ${{ github.env.v2_tag }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 0934542bc15..cd867079fe9 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -58,22 +58,15 @@ jobs: - name: Run ${{ matrix.version.distribution }} integration tests id: test-execution run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - - - name: Upload Metrics Artifact - uses: actions/upload-artifact@v4 + + - name: Metric snapshot (upload or cache metric) + uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version.jaeger }} == "v2" with: - name: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}}.txt - path: ./.metrics/elasticsearch_metrics.txt - retention-days: 7 - - - name: Cache scraped metrics for tagged release for longer retention - uses: actions/cache@v4 - if: contains(github.ref,'tags') && ${{ matrix.version.jaeger }} == "v2" - with: - path: ./.metrics/elasticsearch_metrics.txt - key: ${{ github.ref_name }}_elasticsearch_${{ matrix.version.major }} - + snapshot: ./.metrics/elasticsearch_metrics.txt + artifact_key: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}}.txt + cache_key: ${{ github.ref_name }}_elasticsearch_${{ matrix.version.major }} + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 56e9a6cb2eb..bc9e757b3dc 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -40,21 +40,13 @@ jobs: STORAGE=grpc SPAN_STORAGE_TYPE=memory make jaeger-v2-storage-integration-test ;; esac - - - name: Upload Metrics Artifact - uses: actions/upload-artifact@v4 + - name: Metric snapshot (upload or cache metric) + uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version }} == "v2" with: - name: grpc-metrics-${{ matrix.version }}.txt - path: ./.metrics/grpc_metrics.txt - retention-days: 7 - - - name: Cache scraped metrics for tagged release for longer retention - uses: actions/cache@v4 - if: contains(github.ref,'tags') && ${{ matrix.version }} == "v2" - with: - path: ./.metrics/grpc_metrics.txt - key: ${{ github.ref_name }}_grpc_metrics + snapshot: ./.metrics/grpc_metrics.txt + artifact_key: grpc-metrics-${{ matrix.version }}.txt + cache_key: ${{ github.ref_name }}_grpc_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 991817064ad..4628a89516d 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -35,21 +35,14 @@ jobs: - name: Run kafka integration tests id: test-execution run: bash scripts/kafka-integration-test.sh -j ${{ matrix.jaeger-version }} -v ${{ matrix.kafka-version }} - - - name: Upload Metrics Artifact - uses: actions/upload-artifact@v4 + + - name: Metric snapshot (upload or cache metric) + uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.jaeger-version }} == "v2" with: - name: kafka-metrics-${{ matrix.jaeger-version }}.txt - path: ./.metrics/kafka_metrics.txt - retention-days: 7 - - - name: Cache scraped metrics for tagged release for longer retention - uses: actions/cache@v4 - if: contains(github.ref,'tags') && ${{ matrix.jaeger-version }} == "v2" - with: - path: ./.metrics/kafka_metrics.txt - key: ${{ github.ref_name }}_kafka_metrics + snapshot: ./.metrics/kafka_metrics.txt + artifact_key: kafka-metrics-${{ matrix.jaeger-version }}.txt + cache_key: ${{ github.ref_name }}_kafka_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 47884064998..dcaef2803fc 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -30,19 +30,12 @@ jobs: run: | STORAGE=memory_v2 make jaeger-v2-storage-integration-test - - name: Upload Metrics Artifact - uses: actions/upload-artifact@v4 + - name: Metric snapshot (upload or cache metric) + uses: ./.github/actions/verify-metrics-snapshot with: - name: memory-metrics.txt - path: ./.metrics/memory_metrics.txt - retention-days: 7 - - - name: Cache scraped metrics for tagged release for longer retention - uses: actions/cache@v4 - if: contains(github.ref,'tags') - with: - path: ./.metrics/memory_metrics.txt - key: ${{ github.ref_name }}_memory_metrics + snapshot: ./.metrics/memory_metrics.txt + artifact_key: memory-metrics.txt + cache_key: ${{ github.ref_name }}_memory_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 0109c77260b..947f3d64f89 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -52,20 +52,13 @@ jobs: id: test-execution run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - - name: Upload Metrics Artifact - uses: actions/upload-artifact@v4 + - name: Metric snapshot (upload or cache metric) + uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version.jaeger }} == "v2" with: - name: opensearch-metrics-${{ matrix.version.major }}.txt - path: ./.metrics/opensearch_metrics.txt - retention-days: 7 - - - name: Cache scraped metrics for tagged release for longer retention - uses: actions/cache@v4 - if: contains(github.ref_name,'tags') && ${{ matrix.version.jaeger }} == "v2" - with: - path: ./.metrics/opensearch_metrics.txt - key: ${{ github.ref }}_kafka_metrics_${{ matrix.version.major }} + snapshot: ./.metrics/opensearch_metrics.txt + artifact_key: opensearch-metrics-${{ matrix.version.major }}.txt + cache_key: ${{ github.ref }}_kafka_metrics_${{ matrix.version.major }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov From 23ba35fb332d4d97ff8174b7b46deb938a02c79c Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Wed, 1 Jan 2025 17:52:28 +0530 Subject: [PATCH 18/53] minor fixes Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-cassandra.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 576e7f42cef..ec2d7d0c1a1 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -61,14 +61,14 @@ jobs: if: ${{ matrix.jaeger-version }} == "v2" id: get-v2-tag run: | - v2_tag=$(make echo-v2)" + v2_tag=$(make echo-v2) echo "v2_tag=$v2_tag" >> $GITHUB_ENV echo "v2_tag: $v2_tag" - uses: actions/cache@v4 with: path: ./.metrics/cassandra_metrics.txt - key: ${{ github.env.v2_tag }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} + key: ${{ env.v2_tag }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov From b620f09b32672c22bcac2c457cf512d44343289d Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Thu, 2 Jan 2025 22:43:12 +0530 Subject: [PATCH 19/53] shared action Signed-off-by: chahatsagarmain --- .../actions/verify-metrics-snapshot/action.yaml | 14 +++++++++++++- .github/workflows/ci-e2e-badger.yaml | 1 - .github/workflows/ci-e2e-cassandra.yml | 14 -------------- .github/workflows/ci-e2e-elasticsearch.yml | 1 - .github/workflows/ci-e2e-grpc.yml | 1 - .github/workflows/ci-e2e-kafka.yml | 1 - .github/workflows/ci-e2e-memory.yaml | 1 - .github/workflows/ci-e2e-opensearch.yml | 1 - 8 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 6ce934ca760..57063caff8b 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -28,4 +28,16 @@ runs: uses: actions/cache@v4 with: path: ${{ inputs.snapshot }} - key: ${{ inputs.cache_key }} \ No newline at end of file + key: ${{ github.ref_name }}_${{ inputs.artifact_key }} + + - name: Get v2 tag + run: | + v2_tag=$(make echo-v2 | perl -lne 'print $1 if /^v(\d+.\d+.\d+(-rc\d+)?)$/') + echo "v2_tag=$v2_tag" >> $GITHUB_ENV + echo "$v2_tag" + + - name: Download the cached tagged metrics + uses: actions/cache@v4 + with: + path: cached_${{ inputs.snapshot}} + key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} \ No newline at end of file diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index d160f28a879..e94a4a5a962 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -47,7 +47,6 @@ jobs: with: snapshot: ./.metrics/badger_metrics.txt artifact_key: badger-metrics-${{ matrix.version }}.txt - cache_key: ${{ github.ref_name }}_badger_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index ec2d7d0c1a1..4e3b6e512bd 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -55,20 +55,6 @@ jobs: with: snapshot: ./.metrics/cassandra_metrics.txt artifact_key: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}.txt - cache_key: ${{ github.ref_name }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - - - name: Restore and test cache download - if: ${{ matrix.jaeger-version }} == "v2" - id: get-v2-tag - run: | - v2_tag=$(make echo-v2) - echo "v2_tag=$v2_tag" >> $GITHUB_ENV - echo "v2_tag: $v2_tag" - - - uses: actions/cache@v4 - with: - path: ./.metrics/cassandra_metrics.txt - key: ${{ env.v2_tag }}_cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index cd867079fe9..00c397dd15c 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -65,7 +65,6 @@ jobs: with: snapshot: ./.metrics/elasticsearch_metrics.txt artifact_key: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}}.txt - cache_key: ${{ github.ref_name }}_elasticsearch_${{ matrix.version.major }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index bc9e757b3dc..dfe5635b4ec 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -46,7 +46,6 @@ jobs: with: snapshot: ./.metrics/grpc_metrics.txt artifact_key: grpc-metrics-${{ matrix.version }}.txt - cache_key: ${{ github.ref_name }}_grpc_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 4628a89516d..adb961c8ce7 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -42,7 +42,6 @@ jobs: with: snapshot: ./.metrics/kafka_metrics.txt artifact_key: kafka-metrics-${{ matrix.jaeger-version }}.txt - cache_key: ${{ github.ref_name }}_kafka_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index dcaef2803fc..7eb364fbd19 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -35,7 +35,6 @@ jobs: with: snapshot: ./.metrics/memory_metrics.txt artifact_key: memory-metrics.txt - cache_key: ${{ github.ref_name }}_memory_metrics - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 947f3d64f89..a849204f9ba 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -58,7 +58,6 @@ jobs: with: snapshot: ./.metrics/opensearch_metrics.txt artifact_key: opensearch-metrics-${{ matrix.version.major }}.txt - cache_key: ${{ github.ref }}_kafka_metrics_${{ matrix.version.major }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov From 07fdbec763f9947625d4d7fdf3bd6fa00958c7a4 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Thu, 2 Jan 2025 22:51:12 +0530 Subject: [PATCH 20/53] add shell property Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 57063caff8b..2deaae22624 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -31,10 +31,12 @@ runs: key: ${{ github.ref_name }}_${{ inputs.artifact_key }} - name: Get v2 tag + shell: bash run: | v2_tag=$(make echo-v2 | perl -lne 'print $1 if /^v(\d+.\d+.\d+(-rc\d+)?)$/') echo "v2_tag=$v2_tag" >> $GITHUB_ENV echo "$v2_tag" + - name: Download the cached tagged metrics uses: actions/cache@v4 From 7f3fe776e5317574ada7a459eea9a5c98406d3b2 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 4 Jan 2025 01:21:13 +0530 Subject: [PATCH 21/53] compare metrics Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 17 ++++- .github/workflows/ci-e2e-badger.yaml | 3 +- .github/workflows/ci-e2e-cassandra.yml | 3 +- .github/workflows/ci-e2e-elasticsearch.yml | 3 +- .github/workflows/ci-e2e-grpc.yml | 4 +- .github/workflows/ci-e2e-kafka.yml | 3 +- .github/workflows/ci-e2e-memory.yaml | 3 +- .github/workflows/ci-e2e-opensearch.yml | 3 +- .../internal/integration/trace_writer.go | 2 +- scripts/e2e/compare_metrics.py | 70 +++++++++++++++++++ 10 files changed, 94 insertions(+), 17 deletions(-) create mode 100644 scripts/e2e/compare_metrics.py diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 2deaae22624..afab81c1a3e 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -37,9 +37,22 @@ runs: echo "v2_tag=$v2_tag" >> $GITHUB_ENV echo "$v2_tag" - - name: Download the cached tagged metrics uses: actions/cache@v4 with: path: cached_${{ inputs.snapshot}} - key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} \ No newline at end of file + key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} + + - name: Calculate diff between the snapshots + shell: bash + run: | + python3 ./scripts/e2e/compare_metrics.py --file1 ${{ inputs.snapshot }} --file2 cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ github.ref_name }}_${{ inputs.artifact_key }} + + - name: Upload the diff artifact + uses: actions/upload-artifact@v4 + with: + name: diff_${{ inputs.artifact_key }} + path: ./.metrics/diff_${{ github.ref_name }}_${{ inputs.artifact_key }} + retention-days: 7 + + \ No newline at end of file diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 574694eb175..0ca78c26591 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -41,8 +41,7 @@ jobs: ;; esac - - name: Metric snapshot (upload or cache metric) - uses: ./.github/actions/verify-metrics-snapshot + - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version }} == "v2" with: snapshot: ./.metrics/badger_metrics.txt diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 405c386aa2f..5159ef7ec83 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -49,8 +49,7 @@ jobs: env: SKIP_APPLY_SCHEMA: ${{ matrix.create-schema == 'auto' && true || false }} - - name: Metric snapshot (upload or cache metric) - uses: ./.github/actions/verify-metrics-snapshot + - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.jaeger-version }} == "v2" with: snapshot: ./.metrics/cassandra_metrics.txt diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 0d51de67fff..d0e1ff0875e 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -59,8 +59,7 @@ jobs: id: test-execution run: bash scripts/e2e/elasticsearch.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - - name: Metric snapshot (upload or cache metric) - uses: ./.github/actions/verify-metrics-snapshot + - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version.jaeger }} == "v2" with: snapshot: ./.metrics/elasticsearch_metrics.txt diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index ed6843afea6..79eb70e34bf 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -40,8 +40,8 @@ jobs: STORAGE=grpc SPAN_STORAGE_TYPE=memory make jaeger-v2-storage-integration-test ;; esac - - name: Metric snapshot (upload or cache metric) - uses: ./.github/actions/verify-metrics-snapshot + + - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version }} == "v2" with: snapshot: ./.metrics/grpc_metrics.txt diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index ce0e203ba8f..1c46a73d5be 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -36,8 +36,7 @@ jobs: id: test-execution run: bash scripts/e2e/kafka.sh -j ${{ matrix.jaeger-version }} -v ${{ matrix.kafka-version }} - - name: Metric snapshot (upload or cache metric) - uses: ./.github/actions/verify-metrics-snapshot + - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.jaeger-version }} == "v2" with: snapshot: ./.metrics/kafka_metrics.txt diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 7373e98a27c..13d98b9cb21 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -30,8 +30,7 @@ jobs: run: | STORAGE=memory_v2 make jaeger-v2-storage-integration-test - - name: Metric snapshot (upload or cache metric) - uses: ./.github/actions/verify-metrics-snapshot + - uses: ./.github/actions/verify-metrics-snapshot with: snapshot: ./.metrics/memory_metrics.txt artifact_key: memory-metrics.txt diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index b7be1a8b2e1..4b5c3700838 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -52,8 +52,7 @@ jobs: id: test-execution run: bash scripts/e2e/elasticsearch.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - - name: Metric snapshot (upload or cache metric) - uses: ./.github/actions/verify-metrics-snapshot + - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version.jaeger }} == "v2" with: snapshot: ./.metrics/opensearch_metrics.txt diff --git a/cmd/jaeger/internal/integration/trace_writer.go b/cmd/jaeger/internal/integration/trace_writer.go index c5286aa44d0..999ce34fb4d 100644 --- a/cmd/jaeger/internal/integration/trace_writer.go +++ b/cmd/jaeger/internal/integration/trace_writer.go @@ -81,7 +81,7 @@ func (w *traceWriter) WriteTraces(ctx context.Context, td ptrace.Traces) error { scope ptrace.ScopeSpans resource ptrace.ResourceSpans ) - + if spanCount == MaxChunkSize { err = w.exporter.ConsumeTraces(ctx, currentChunk) currentChunk = ptrace.NewTraces() diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py new file mode 100644 index 00000000000..d6eba698670 --- /dev/null +++ b/scripts/e2e/compare_metrics.py @@ -0,0 +1,70 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import difflib +import sys +from pathlib import Path + +def read_metric_file(file_path): + try: + with open(file_path, 'r') as f: + return f.readlines() + except FileNotFoundError: + print(f"Error: File not found - {file_path}") + sys.exit(1) + except Exception as e: + print(f"Error reading file {file_path}: {str(e)}") + sys.exit(1) + +def generate_diff(file1_lines, file2_lines, file1_name, file2_name): + + return list(difflib.unified_diff( + file1_lines, + file2_lines, + fromfile=file1_name, + tofile=file2_name, + lineterm='' + )) + +def write_diff_file(diff_lines, output_path): + try: + with open(output_path, 'w') as f: + f.write('\n'.join(diff_lines)) + f.write('\n') # Add final newline + print(f"Diff file successfully written to: {output_path}") + except Exception as e: + print(f"Error writing diff file: {str(e)}") + sys.exit(1) + +def main(): + parser = argparse.ArgumentParser(description='Generate diff between two Jaeger metric files') + parser.add_argument('--file1', help='Path to first metric file') + parser.add_argument('--file2', help='Path to second metric file') + parser.add_argument('--output', '-o', default='metrics_diff.txt', + help='Output diff file path (default: metrics_diff.txt)') + + args = parser.parse_args() + + # Convert paths to absolute paths + file1_path = Path(args.file1).absolute() + file2_path = Path(args.file2).absolute() + output_path = Path(args.output).absolute() + + # Read input files + file1_lines = read_metric_file(file1_path) + file2_lines = read_metric_file(file2_path) + + # Generate diff + diff_lines = generate_diff(file1_lines, file2_lines, str(file1_path), str(file2_path)) + + # Check if there are any differences + if not diff_lines: + print("No differences found between the metric files.") + sys.exit(0) + + # Write diff to output file + write_diff_file(diff_lines, output_path) + +if __name__ == '__main__': + main() \ No newline at end of file From 8c81c82780d7c38668c0fd26f67e0af17f973141 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 4 Jan 2025 01:55:52 +0530 Subject: [PATCH 22/53] fix path Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 10 +++++----- .github/workflows/ci-e2e-badger.yaml | 2 +- .github/workflows/ci-e2e-cassandra.yml | 2 +- .github/workflows/ci-e2e-elasticsearch.yml | 2 +- .github/workflows/ci-e2e-grpc.yml | 2 +- .github/workflows/ci-e2e-kafka.yml | 2 +- .github/workflows/ci-e2e-memory.yaml | 2 +- .github/workflows/ci-e2e-opensearch.yml | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index afab81c1a3e..e9b79a90b25 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -20,14 +20,14 @@ runs: uses: actions/upload-artifact@v4 with: name: ${{ inputs.artifact_key }} - path: ${{ inputs.snapshot }} + path: ./.metrics/${{ inputs.snapshot }} retention-days: 7 - name: Cache scraped metrics for tagged release for longer retention if: contains(github.ref,'tags') uses: actions/cache@v4 with: - path: ${{ inputs.snapshot }} + path: ./.metrics/${{ inputs.snapshot }} key: ${{ github.ref_name }}_${{ inputs.artifact_key }} - name: Get v2 tag @@ -40,19 +40,19 @@ runs: - name: Download the cached tagged metrics uses: actions/cache@v4 with: - path: cached_${{ inputs.snapshot}} + path: ./.metrics/cached_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} - name: Calculate diff between the snapshots shell: bash run: | - python3 ./scripts/e2e/compare_metrics.py --file1 ${{ inputs.snapshot }} --file2 cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ github.ref_name }}_${{ inputs.artifact_key }} + python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} - name: Upload the diff artifact uses: actions/upload-artifact@v4 with: name: diff_${{ inputs.artifact_key }} - path: ./.metrics/diff_${{ github.ref_name }}_${{ inputs.artifact_key }} + path: ./.metrics/diff_${{ inputs.snapshot }} retention-days: 7 \ No newline at end of file diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 0ca78c26591..5c9702d9219 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -44,7 +44,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version }} == "v2" with: - snapshot: ./.metrics/badger_metrics.txt + snapshot: badger_metrics.txt artifact_key: badger-metrics-${{ matrix.version }}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 5159ef7ec83..341f86adccb 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -52,7 +52,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.jaeger-version }} == "v2" with: - snapshot: ./.metrics/cassandra_metrics.txt + snapshot: cassandra_metrics.txt artifact_key: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index d0e1ff0875e..432533ab786 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -62,7 +62,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version.jaeger }} == "v2" with: - snapshot: ./.metrics/elasticsearch_metrics.txt + snapshot: elasticsearch_metrics.txt artifact_key: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 79eb70e34bf..3c25166b8cb 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -44,7 +44,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version }} == "v2" with: - snapshot: ./.metrics/grpc_metrics.txt + snapshot: grpc_metrics.txt artifact_key: grpc-metrics-${{ matrix.version }}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 1c46a73d5be..0d01269bd26 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -39,7 +39,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.jaeger-version }} == "v2" with: - snapshot: ./.metrics/kafka_metrics.txt + snapshot: kafka_metrics.txt artifact_key: kafka-metrics-${{ matrix.jaeger-version }}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 13d98b9cb21..f71cf810ee4 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -32,7 +32,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot with: - snapshot: ./.metrics/memory_metrics.txt + snapshot: memory_metrics.txt artifact_key: memory-metrics.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 4b5c3700838..2ff79b920d1 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -55,7 +55,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: ${{ matrix.version.jaeger }} == "v2" with: - snapshot: ./.metrics/opensearch_metrics.txt + snapshot: opensearch_metrics.txt artifact_key: opensearch-metrics-${{ matrix.version.major }}.txt - name: Upload coverage to codecov From a76bcde88e420c40b45782e92b5e0aa78f0bf9f8 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 4 Jan 2025 02:16:56 +0530 Subject: [PATCH 23/53] fix compare Signed-off-by: chahatsagarmain --- scripts/e2e/compare_metrics.py | 71 +++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index d6eba698670..61d540bb25d 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 import argparse -import difflib +import re import sys from pathlib import Path @@ -10,22 +10,68 @@ def read_metric_file(file_path): try: with open(file_path, 'r') as f: return f.readlines() - except FileNotFoundError: - print(f"Error: File not found - {file_path}") - sys.exit(1) except Exception as e: print(f"Error reading file {file_path}: {str(e)}") - sys.exit(1) + +def parse_metric_line(line): + + # Skip empty lines or comments + line = line.strip() + if not line or line.startswith('#'): + return None + + # Extract metric name and labels section + match = re.match(r'([^{]+)(?:{(.+)})?(?:\s+[-+]?[0-9.eE+-]+)?$', line) + if not match: + return None + + name = match.group(1) + labels_str = match.group(2) or '' + + # Parse labels into a frozenset of (key, value) tuples + labels = [] + if labels_str: + for label in labels_str.split(','): + label = label.strip() + if '=' in label: + key, value = label.split('=', 1) + labels.append((key.strip(), value.strip())) + + # Sort labels and convert to frozenset for comparison + return (name, frozenset(sorted(labels))) def generate_diff(file1_lines, file2_lines, file1_name, file2_name): - return list(difflib.unified_diff( - file1_lines, - file2_lines, - fromfile=file1_name, - tofile=file2_name, - lineterm='' - )) + # Parse metrics from both files + metrics1 = {} # {(name, labels_frozenset): original_line} + metrics2 = {} + + for line in file1_lines: + parsed = parse_metric_line(line) + if parsed: + metrics1[parsed] = line.strip() + + for line in file2_lines: + parsed = parse_metric_line(line) + if parsed: + metrics2[parsed] = line.strip() + + # Generate diff + diff_lines = [] + diff_lines.append(f'--- {file1_name}') + diff_lines.append(f'+++ {file2_name}') + + # Find metrics unique to file1 (removed metrics) + for metric in sorted(set(metrics1.keys()) - set(metrics2.keys())): + name, labels = metric + diff_lines.append(f'-{metrics1[metric]}') + + # Find metrics unique to file2 (added metrics) + for metric in sorted(set(metrics2.keys()) - set(metrics1.keys())): + name, labels = metric + diff_lines.append(f'+{metrics2[metric]}') + + return diff_lines def write_diff_file(diff_lines, output_path): try: @@ -35,7 +81,6 @@ def write_diff_file(diff_lines, output_path): print(f"Diff file successfully written to: {output_path}") except Exception as e: print(f"Error writing diff file: {str(e)}") - sys.exit(1) def main(): parser = argparse.ArgumentParser(description='Generate diff between two Jaeger metric files') From 2b27c957157e79695e476e1b886d834cb4764a42 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 4 Jan 2025 03:55:07 +0530 Subject: [PATCH 24/53] minor changes Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 3 ++- scripts/e2e/compare_metrics.py | 22 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index e9b79a90b25..1472aae7f93 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -33,7 +33,8 @@ runs: - name: Get v2 tag shell: bash run: | - v2_tag=$(make echo-v2 | perl -lne 'print $1 if /^v(\d+.\d+.\d+(-rc\d+)?)$/') + git fetch --prune --unshallow --tags + v2_tag=$(make echo-v2) echo "v2_tag=$v2_tag" >> $GITHUB_ENV echo "$v2_tag" diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index 61d540bb25d..cb2992a18f0 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -7,11 +7,8 @@ from pathlib import Path def read_metric_file(file_path): - try: - with open(file_path, 'r') as f: - return f.readlines() - except Exception as e: - print(f"Error reading file {file_path}: {str(e)}") + with open(file_path, 'r') as f: + return f.readlines() def parse_metric_line(line): @@ -74,13 +71,11 @@ def generate_diff(file1_lines, file2_lines, file1_name, file2_name): return diff_lines def write_diff_file(diff_lines, output_path): - try: - with open(output_path, 'w') as f: - f.write('\n'.join(diff_lines)) - f.write('\n') # Add final newline + + with open(output_path, 'w') as f: + f.write('\n'.join(diff_lines)) + f.write('\n') # Add final newline print(f"Diff file successfully written to: {output_path}") - except Exception as e: - print(f"Error writing diff file: {str(e)}") def main(): parser = argparse.ArgumentParser(description='Generate diff between two Jaeger metric files') @@ -99,6 +94,11 @@ def main(): # Read input files file1_lines = read_metric_file(file1_path) file2_lines = read_metric_file(file2_path) + + # No cached file found + if not file1_lines or not file2_lines: + print("No cached file") + sys.exit(0) # Generate diff diff_lines = generate_diff(file1_lines, file2_lines, str(file1_path), str(file2_path)) From 77ed7412d4766c42c318e81b53ab998b669972e2 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 4 Jan 2025 15:16:56 +0530 Subject: [PATCH 25/53] compare metrics using python libraries Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 1 + scripts/e2e/compare_metrics.py | 100 ++++++------------ 2 files changed, 33 insertions(+), 68 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 1472aae7f93..6bf3240e3f3 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -47,6 +47,7 @@ runs: - name: Calculate diff between the snapshots shell: bash run: | + python3 -m pip install prometheus-client deepdiff python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} - name: Upload the diff artifact diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index cb2992a18f0..3e2b1e587b2 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -2,78 +2,48 @@ # SPDX-License-Identifier: Apache-2.0 import argparse -import re import sys +import json +import deepdiff from pathlib import Path +from prometheus_client.parser import text_string_to_metric_families def read_metric_file(file_path): with open(file_path, 'r') as f: return f.readlines() - -def parse_metric_line(line): - - # Skip empty lines or comments - line = line.strip() - if not line or line.startswith('#'): - return None - - # Extract metric name and labels section - match = re.match(r'([^{]+)(?:{(.+)})?(?:\s+[-+]?[0-9.eE+-]+)?$', line) - if not match: - return None - - name = match.group(1) - labels_str = match.group(2) or '' - - # Parse labels into a frozenset of (key, value) tuples - labels = [] - if labels_str: - for label in labels_str.split(','): - label = label.strip() - if '=' in label: - key, value = label.split('=', 1) - labels.append((key.strip(), value.strip())) - # Sort labels and convert to frozenset for comparison - return (name, frozenset(sorted(labels))) +def parse_metrics(content): + metrics = {} + for family in text_string_to_metric_families(content): + for sample in family.samples: + key = (family.name, frozenset(sorted(sample.labels.items()))) + metrics[key] = { + 'name': family.name, + 'labels': dict(sample.labels), + } + return metrics -def generate_diff(file1_lines, file2_lines, file1_name, file2_name): +def generate_diff(file1_content, file2_content): + if isinstance(file1_content, list): + file1_content = ''.join(file1_content) + if isinstance(file2_content, list): + file2_content = ''.join(file2_content) - # Parse metrics from both files - metrics1 = {} # {(name, labels_frozenset): original_line} - metrics2 = {} - - for line in file1_lines: - parsed = parse_metric_line(line) - if parsed: - metrics1[parsed] = line.strip() - - for line in file2_lines: - parsed = parse_metric_line(line) - if parsed: - metrics2[parsed] = line.strip() - - # Generate diff - diff_lines = [] - diff_lines.append(f'--- {file1_name}') - diff_lines.append(f'+++ {file2_name}') - - # Find metrics unique to file1 (removed metrics) - for metric in sorted(set(metrics1.keys()) - set(metrics2.keys())): - name, labels = metric - diff_lines.append(f'-{metrics1[metric]}') - - # Find metrics unique to file2 (added metrics) - for metric in sorted(set(metrics2.keys()) - set(metrics1.keys())): - name, labels = metric - diff_lines.append(f'+{metrics2[metric]}') - - return diff_lines + metrics1 = parse_metrics(file1_content) + metrics2 = parse_metrics(file2_content) + + # Compare metrics ignoring values + diff = deepdiff.DeepDiff(metrics1, metrics2,ignore_order=True,exclude_paths=["root['value']"]) + diff_dict = diff.to_dict() + diff_dict['metrics_in_tagged_only'] = diff_dict.pop('dictionary_item_added') + diff_dict['metrics_in_current_only'] = diff_dict.pop('dictionary_item_removed') + diff_json = json.dumps(diff_dict,indent=4,default=tuple,sort_keys=True) + return diff_json def write_diff_file(diff_lines, output_path): with open(output_path, 'w') as f: - f.write('\n'.join(diff_lines)) + f.write(diff_lines) f.write('\n') # Add final newline print(f"Diff file successfully written to: {output_path}") @@ -86,19 +56,13 @@ def main(): args = parser.parse_args() - # Convert paths to absolute paths - file1_path = Path(args.file1).absolute() - file2_path = Path(args.file2).absolute() - output_path = Path(args.output).absolute() + file1_path = Path(args.file1) + file2_path = Path(args.file2) + output_path = Path(args.output) # Read input files file1_lines = read_metric_file(file1_path) file2_lines = read_metric_file(file2_path) - - # No cached file found - if not file1_lines or not file2_lines: - print("No cached file") - sys.exit(0) # Generate diff diff_lines = generate_diff(file1_lines, file2_lines, str(file1_path), str(file2_path)) From 22e97a230f1afa06ddcb5a2021381173a8a79bea Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sat, 4 Jan 2025 15:31:04 +0530 Subject: [PATCH 26/53] check path Signed-off-by: chahatsagarmain --- scripts/e2e/compare_metrics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index 3e2b1e587b2..2cf605ebfc0 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -56,9 +56,9 @@ def main(): args = parser.parse_args() - file1_path = Path(args.file1) - file2_path = Path(args.file2) - output_path = Path(args.output) + file1_path = args.file1 + file2_path = args.file2 + output_path = args.output # Read input files file1_lines = read_metric_file(file1_path) From 8da8a07e3268f60d5b076f2a4340bfc2dee2eaa0 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 5 Jan 2025 00:30:51 +0530 Subject: [PATCH 27/53] resolved comments Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 8 ++++---- scripts/e2e/compare_metrics.py | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 6bf3240e3f3..80cc39e7523 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -17,7 +17,7 @@ runs: using: 'composite' steps: - name: Upload Metrics Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b with: name: ${{ inputs.artifact_key }} path: ./.metrics/${{ inputs.snapshot }} @@ -25,7 +25,7 @@ runs: - name: Cache scraped metrics for tagged release for longer retention if: contains(github.ref,'tags') - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: ./.metrics/${{ inputs.snapshot }} key: ${{ github.ref_name }}_${{ inputs.artifact_key }} @@ -39,7 +39,7 @@ runs: echo "$v2_tag" - name: Download the cached tagged metrics - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: ./.metrics/cached_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} @@ -51,7 +51,7 @@ runs: python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} - name: Upload the diff artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b with: name: diff_${{ inputs.artifact_key }} path: ./.metrics/diff_${{ inputs.snapshot }} diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index 2cf605ebfc0..7cae81dd642 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -56,16 +56,12 @@ def main(): args = parser.parse_args() - file1_path = args.file1 - file2_path = args.file2 - output_path = args.output - # Read input files - file1_lines = read_metric_file(file1_path) - file2_lines = read_metric_file(file2_path) + file1_lines = read_metric_file(args.file1) + file2_lines = read_metric_file(args.file2) # Generate diff - diff_lines = generate_diff(file1_lines, file2_lines, str(file1_path), str(file2_path)) + diff_lines = generate_diff(file1_lines, file2_lines, str(args.file1), str(args.file2)) # Check if there are any differences if not diff_lines: @@ -73,7 +69,7 @@ def main(): sys.exit(0) # Write diff to output file - write_diff_file(diff_lines, output_path) + write_diff_file(diff_lines, args.output) if __name__ == '__main__': main() \ No newline at end of file From 90464e24139654ff427eb56210989b9bb0a60194 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 5 Jan 2025 01:31:52 +0530 Subject: [PATCH 28/53] use simple unified diff Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 4 +-- scripts/e2e/compare_metrics.py | 31 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 80cc39e7523..b392a61c230 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -17,7 +17,7 @@ runs: using: 'composite' steps: - name: Upload Metrics Artifact - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: ${{ inputs.artifact_key }} path: ./.metrics/${{ inputs.snapshot }} @@ -51,7 +51,7 @@ runs: python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} - name: Upload the diff artifact - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: diff_${{ inputs.artifact_key }} path: ./.metrics/diff_${{ inputs.snapshot }} diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index 7cae81dd642..a8e94b52e4a 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -3,9 +3,8 @@ import argparse import sys -import json -import deepdiff -from pathlib import Path +from difflib import unified_diff +from bisect import insort from prometheus_client.parser import text_string_to_metric_families def read_metric_file(file_path): @@ -13,16 +12,20 @@ def read_metric_file(file_path): return f.readlines() def parse_metrics(content): - metrics = {} + metrics = [] for family in text_string_to_metric_families(content): for sample in family.samples: - key = (family.name, frozenset(sorted(sample.labels.items()))) - metrics[key] = { - 'name': family.name, - 'labels': dict(sample.labels), - } + labels = dict(sample.labels) + #simply pop undesirable metric labels + labels.pop('service_instance_id',None) + label_pairs = sorted(labels.items(), key=lambda x: x[0]) + label_str = ','.join(f'{k}="{v}"' for k,v in label_pairs) + metric = f"{family.name}{{{label_str}}}" + insort(metrics , metric) + return metrics + def generate_diff(file1_content, file2_content): if isinstance(file1_content, list): file1_content = ''.join(file1_content) @@ -32,13 +35,9 @@ def generate_diff(file1_content, file2_content): metrics1 = parse_metrics(file1_content) metrics2 = parse_metrics(file2_content) - # Compare metrics ignoring values - diff = deepdiff.DeepDiff(metrics1, metrics2,ignore_order=True,exclude_paths=["root['value']"]) - diff_dict = diff.to_dict() - diff_dict['metrics_in_tagged_only'] = diff_dict.pop('dictionary_item_added') - diff_dict['metrics_in_current_only'] = diff_dict.pop('dictionary_item_removed') - diff_json = json.dumps(diff_dict,indent=4,default=tuple,sort_keys=True) - return diff_json + diff = unified_diff(metrics1, metrics2,lineterm='',n=0) + + return '\n'.join(diff) def write_diff_file(diff_lines, output_path): From 19835c4b6b00c2e822b95f39c7a01a994ab433ff Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 5 Jan 2025 02:40:09 +0530 Subject: [PATCH 29/53] exit cases Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index b392a61c230..a87b9ef0d0a 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -44,17 +44,35 @@ runs: path: ./.metrics/cached_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} + - name: Check cache and exit action + if: steps.cache-metrics.outputs.cache-hit != 'true' + shell: bash + run: | + echo "::notice::No cached metrics found for comparison, skipping remaining steps" + exit 78 + - name: Calculate diff between the snapshots + id: diff-check shell: bash run: | - python3 -m pip install prometheus-client deepdiff - python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} + python3 -m pip install prometheus-client + if ! python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }}; then + echo "diff_found=true" >> $GITHUB_ENV + exit 1 + fi - name: Upload the diff artifact + if: env.diff_found == 'true' uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: diff_${{ inputs.artifact_key }} path: ./.metrics/diff_${{ inputs.snapshot }} retention-days: 7 + - name: Fail if differences found + if: env.diff_found == 'true' + shell: bash + run: | + echo "::error::Differences found in metrics comparison" + exit 1 \ No newline at end of file From 63a64f3966e9f7bcbf38bb7714bedf7f1bdce82a Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 5 Jan 2025 02:59:31 +0530 Subject: [PATCH 30/53] simplified action Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index a87b9ef0d0a..046e8bab9b4 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -44,35 +44,20 @@ runs: path: ./.metrics/cached_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} - - name: Check cache and exit action - if: steps.cache-metrics.outputs.cache-hit != 'true' - shell: bash - run: | - echo "::notice::No cached metrics found for comparison, skipping remaining steps" - exit 78 - - name: Calculate diff between the snapshots id: diff-check + if: steps.cache-metrics.outputs.cache-hit == 'true' shell: bash run: | python3 -m pip install prometheus-client - if ! python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }}; then - echo "diff_found=true" >> $GITHUB_ENV - exit 1 - fi + python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} - name: Upload the diff artifact - if: env.diff_found == 'true' + if: steps.cache-metrics.outputs.cache-hit == 'true' && steps.diff-check.outcome == 'failure' uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: diff_${{ inputs.artifact_key }} path: ./.metrics/diff_${{ inputs.snapshot }} retention-days: 7 - - name: Fail if differences found - if: env.diff_found == 'true' - shell: bash - run: | - echo "::error::Differences found in metrics comparison" - exit 1 \ No newline at end of file From 0a1787f9e236397f0e71135f0e97a9224fa181da Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 5 Jan 2025 03:03:30 +0530 Subject: [PATCH 31/53] exit case Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 046e8bab9b4..a25355c9f5b 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -50,7 +50,9 @@ runs: shell: bash run: | python3 -m pip install prometheus-client - python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} + if ! python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }}; then + exit 1 + fi - name: Upload the diff artifact if: steps.cache-metrics.outputs.cache-hit == 'true' && steps.diff-check.outcome == 'failure' From b30dad5fd6440efdf6a4f3ba3a50d3051c5c85ff Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 5 Jan 2025 03:20:29 +0530 Subject: [PATCH 32/53] fetch tags after checkout Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 1 - .github/workflows/ci-e2e-badger.yaml | 4 ++++ .github/workflows/ci-e2e-cassandra.yml | 4 ++++ .github/workflows/ci-e2e-grpc.yml | 4 ++++ .github/workflows/ci-e2e-kafka.yml | 4 ++++ .github/workflows/ci-e2e-memory.yaml | 4 ++++ 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index a25355c9f5b..7df4486daad 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -33,7 +33,6 @@ runs: - name: Get v2 tag shell: bash run: | - git fetch --prune --unshallow --tags v2_tag=$(make echo-v2) echo "v2_tag=$v2_tag" >> $GITHUB_ENV echo "$v2_tag" diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 5c9702d9219..260923f1d23 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -26,6 +26,10 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - name: Fetch git tags + run: | + git fetch --prune --unshallow --tags + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 341f86adccb..9c03a9abf13 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -39,6 +39,10 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - name: Fetch git tags + run: | + git fetch --prune --unshallow --tags + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 3c25166b8cb..49119f06b4b 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -26,6 +26,10 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - name: Fetch git tags + run: | + git fetch --prune --unshallow --tags + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 0d01269bd26..5f111c12285 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -28,6 +28,10 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - name: Fetch git tags + run: | + git fetch --prune --unshallow --tags + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index f71cf810ee4..3dd605881a7 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -22,6 +22,10 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - name: Fetch git tags + run: | + git fetch --prune --unshallow --tags + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x From d81694ecbbb53e59c4513c420332e30c66dd730b Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 6 Jan 2025 19:07:00 +0530 Subject: [PATCH 33/53] changes Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 40 ++++++++++++++----- .github/workflows/ci-e2e-badger.yaml | 2 +- .github/workflows/ci-e2e-cassandra.yml | 2 +- .github/workflows/ci-e2e-elasticsearch.yml | 2 +- .github/workflows/ci-e2e-grpc.yml | 2 +- .github/workflows/ci-e2e-kafka.yml | 2 +- .github/workflows/ci-e2e-opensearch.yml | 2 +- scripts/e2e/compare_metrics.py | 6 ++- 8 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 7df4486daad..b320cdb2f0e 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -23,22 +23,38 @@ runs: path: ./.metrics/${{ inputs.snapshot }} retention-days: 7 - - name: Cache scraped metrics for tagged release for longer retention - if: contains(github.ref,'tags') - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: ./.metrics/${{ inputs.snapshot }} - key: ${{ github.ref_name }}_${{ inputs.artifact_key }} - - name: Get v2 tag shell: bash run: | v2_tag=$(make echo-v2) echo "v2_tag=$v2_tag" >> $GITHUB_ENV echo "$v2_tag" + + - name: Check existing cache + id: check-cache + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 + with: + path: ./.metrics/cached_${{ inputs.snapshot}} + key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} + lookup-only: true + + - name: Change file name before caching + if: ${{ (github.ref_name == 'main') && (steps.check-cache.outputs.cache-hit != 'true') }} + shell: bash + run: | + mv ./.metrics/${{ inputs.snapshot }} ./.metrics/cached_${{ inputs.snapshot}} + + - name: Cache scraped metrics for tagged release for longer retention + id: tagged-metrics + if: ${{ (github.ref_name == 'main') && (steps.check-cache.outputs.cache-hit != 'true') }} + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 + with: + path: ./.metrics/cached_${{ inputs.snapshot}} + key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} - name: Download the cached tagged metrics - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 + id: cache-metrics + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: ./.metrics/cached_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} @@ -49,12 +65,14 @@ runs: shell: bash run: | python3 -m pip install prometheus-client - if ! python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }}; then - exit 1 + python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} + if [ $? -eq 0 ]; then + echo "No differences found in metrics" + exit 1 fi - name: Upload the diff artifact - if: steps.cache-metrics.outputs.cache-hit == 'true' && steps.diff-check.outcome == 'failure' + if: ${{ (steps.cache-metrics.outputs.cache-hit == 'true') && (steps.diff-check.outcome == 'failure') }} uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: diff_${{ inputs.artifact_key }} diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 260923f1d23..736246bdafc 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -46,7 +46,7 @@ jobs: esac - uses: ./.github/actions/verify-metrics-snapshot - if: ${{ matrix.version }} == "v2" + if: matrix.version == 'v2' with: snapshot: badger_metrics.txt artifact_key: badger-metrics-${{ matrix.version }}.txt diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 9c03a9abf13..0e3ab7e2dc6 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -54,7 +54,7 @@ jobs: SKIP_APPLY_SCHEMA: ${{ matrix.create-schema == 'auto' && true || false }} - uses: ./.github/actions/verify-metrics-snapshot - if: ${{ matrix.jaeger-version }} == "v2" + if: matrix.jaeger-version == 'v2' with: snapshot: cassandra_metrics.txt artifact_key: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}.txt diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 432533ab786..8d66ba3569d 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -60,7 +60,7 @@ jobs: run: bash scripts/e2e/elasticsearch.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - uses: ./.github/actions/verify-metrics-snapshot - if: ${{ matrix.version.jaeger }} == "v2" + if: matrix.version.jaeger == 'v2' with: snapshot: elasticsearch_metrics.txt artifact_key: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}}.txt diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 49119f06b4b..f47c9adf08d 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -46,7 +46,7 @@ jobs: esac - uses: ./.github/actions/verify-metrics-snapshot - if: ${{ matrix.version }} == "v2" + if: matrix.version == 'v2' with: snapshot: grpc_metrics.txt artifact_key: grpc-metrics-${{ matrix.version }}.txt diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 5f111c12285..7cf46accc76 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -41,7 +41,7 @@ jobs: run: bash scripts/e2e/kafka.sh -j ${{ matrix.jaeger-version }} -v ${{ matrix.kafka-version }} - uses: ./.github/actions/verify-metrics-snapshot - if: ${{ matrix.jaeger-version }} == "v2" + if: matrix.jaeger-version == 'v2' with: snapshot: kafka_metrics.txt artifact_key: kafka-metrics-${{ matrix.jaeger-version }}.txt diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 2ff79b920d1..78f10e284ce 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -53,7 +53,7 @@ jobs: run: bash scripts/e2e/elasticsearch.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - uses: ./.github/actions/verify-metrics-snapshot - if: ${{ matrix.version.jaeger }} == "v2" + if: matrix.version.jaeger == 'v2' with: snapshot: opensearch_metrics.txt artifact_key: opensearch-metrics-${{ matrix.version.major }}.txt diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index a8e94b52e4a..0a8f62519d0 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -60,15 +60,17 @@ def main(): file2_lines = read_metric_file(args.file2) # Generate diff - diff_lines = generate_diff(file1_lines, file2_lines, str(args.file1), str(args.file2)) + diff_lines = generate_diff(file1_lines, file2_lines) # Check if there are any differences if not diff_lines: print("No differences found between the metric files.") - sys.exit(0) + sys.exit(1) # Write diff to output file write_diff_file(diff_lines, args.output) + return 0 + if __name__ == '__main__': main() \ No newline at end of file From 6f5355cf94a2eeeb99318f223894d96c1c84df55 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 6 Jan 2025 19:13:42 +0530 Subject: [PATCH 34/53] exit code Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index b320cdb2f0e..9a4e2109134 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -66,7 +66,7 @@ runs: run: | python3 -m pip install prometheus-client python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} - if [ $? -eq 0 ]; then + if [ $? -eq 1 ]; then echo "No differences found in metrics" exit 1 fi From 1bdb77f4ee4fd2babd853b2616c1dfe12ec4af33 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 6 Jan 2025 19:39:04 +0530 Subject: [PATCH 35/53] print diff Signed-off-by: chahatsagarmain --- scripts/e2e/compare_metrics.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index 0a8f62519d0..c56d509902e 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -70,6 +70,9 @@ def main(): # Write diff to output file write_diff_file(diff_lines, args.output) + print("\n=== Metrics Comparison Results ===") + print(diff_lines) + return 0 if __name__ == '__main__': From 157822dd5efc4e0cbfd49b82042b2cd049ad9e28 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 7 Jan 2025 02:15:23 +0530 Subject: [PATCH 36/53] minor changes Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 18 +++++++++--------- scripts/e2e/compare_metrics.py | 16 +++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 9a4e2109134..7104a75c372 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -34,7 +34,7 @@ runs: id: check-cache uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: - path: ./.metrics/cached_${{ inputs.snapshot}} + path: ./.metrics/release_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} lookup-only: true @@ -42,37 +42,37 @@ runs: if: ${{ (github.ref_name == 'main') && (steps.check-cache.outputs.cache-hit != 'true') }} shell: bash run: | - mv ./.metrics/${{ inputs.snapshot }} ./.metrics/cached_${{ inputs.snapshot}} + mv ./.metrics/${{ inputs.snapshot }} ./.metrics/release_${{ inputs.snapshot}} - name: Cache scraped metrics for tagged release for longer retention id: tagged-metrics if: ${{ (github.ref_name == 'main') && (steps.check-cache.outputs.cache-hit != 'true') }} uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: - path: ./.metrics/cached_${{ inputs.snapshot}} + path: ./.metrics/release_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} - name: Download the cached tagged metrics - id: cache-metrics + id: download-release-snapshot uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: - path: ./.metrics/cached_${{ inputs.snapshot}} + path: ./.metrics/release_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} - name: Calculate diff between the snapshots - id: diff-check - if: steps.cache-metrics.outputs.cache-hit == 'true' + id: compare-snapshots + if: steps.download-release-snapshot.outputs.cache-hit == 'true' shell: bash run: | python3 -m pip install prometheus-client python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} if [ $? -eq 1 ]; then - echo "No differences found in metrics" + echo "Differences found in metrics" exit 1 fi - name: Upload the diff artifact - if: ${{ (steps.cache-metrics.outputs.cache-hit == 'true') && (steps.diff-check.outcome == 'failure') }} + if: ${{ (steps.download-release-snapshot.outputs.cache-hit == 'true') && (steps.compare-snapshots.outcome == 'failure') }} uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: diff_${{ inputs.artifact_key }} diff --git a/scripts/e2e/compare_metrics.py b/scripts/e2e/compare_metrics.py index c56d509902e..c30edb4114f 100644 --- a/scripts/e2e/compare_metrics.py +++ b/scripts/e2e/compare_metrics.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 import argparse -import sys from difflib import unified_diff from bisect import insort from prometheus_client.parser import text_string_to_metric_families @@ -63,16 +62,15 @@ def main(): diff_lines = generate_diff(file1_lines, file2_lines) # Check if there are any differences - if not diff_lines: - print("No differences found between the metric files.") - sys.exit(1) - - # Write diff to output file - write_diff_file(diff_lines, args.output) + if diff_lines: + print("differences found between the metric files.") + print("=== Metrics Comparison Results ===") + print(diff_lines) + write_diff_file(diff_lines, args.output) - print("\n=== Metrics Comparison Results ===") - print(diff_lines) + return 1 + print("no difference found") return 0 if __name__ == '__main__': From 2ea739b5835d8dfa6a9d7403f1a85fb2879a9526 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 7 Jan 2025 20:21:35 +0530 Subject: [PATCH 37/53] added comment Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 7104a75c372..5afc45e6cdd 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -1,6 +1,8 @@ # Copyright (c) 2023 The Jaeger Authors. # SPDX-License-Identifier: Apache-2.0 + + name: 'Verify Metric Snapshot and Upload Metrics' description: 'Upload or cache the metrics data after verification' inputs: @@ -37,7 +39,9 @@ runs: path: ./.metrics/release_${{ inputs.snapshot}} key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} lookup-only: true - + + # The github cache restore successfully restores when cache saved has same key and same path. + # Hence to restore release metric with name relese_{metric_name} , the name must be changed to the same. - name: Change file name before caching if: ${{ (github.ref_name == 'main') && (steps.check-cache.outputs.cache-hit != 'true') }} shell: bash From 20514ab3f7fc66c4eec61c9319359c43ab9b9478 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 7 Jan 2025 20:25:28 +0530 Subject: [PATCH 38/53] test Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-cassandra.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 0e3ab7e2dc6..ff59b9b2ce3 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -38,10 +38,8 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Fetch git tags - run: | - git fetch --prune --unshallow --tags + with: + fetch-depth: 1 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: From 8d92555078f89b41c05bb4746b8951ff4c51d6c7 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 7 Jan 2025 20:42:00 +0530 Subject: [PATCH 39/53] fetch depth 0 Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-cassandra.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index ff59b9b2ce3..01d1e430e97 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: - fetch-depth: 1 + fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: From a7f2b6771155037471ce8d94b431a70dca07921e Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 7 Jan 2025 21:08:24 +0530 Subject: [PATCH 40/53] changes Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-badger.yaml | 8 +++----- .github/workflows/ci-e2e-elasticsearch.yml | 7 ++----- .github/workflows/ci-e2e-grpc.yml | 6 ++---- .github/workflows/ci-e2e-kafka.yml | 6 ++---- .github/workflows/ci-e2e-memory.yaml | 8 +++----- .github/workflows/ci-e2e-opensearch.yml | 5 +---- 6 files changed, 13 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 736246bdafc..3938dee231a 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -25,11 +25,9 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Fetch git tags - run: | - git fetch --prune --unshallow --tags - + with: + fetch-depth: 0 + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 8d66ba3569d..ba28fc33642 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -40,11 +40,8 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: true - - - name: Fetch git tags - run: | - git fetch --prune --unshallow --tags - + fetch-depth: 0 + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index f47c9adf08d..e31f45a9cf7 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -25,10 +25,8 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Fetch git tags - run: | - git fetch --prune --unshallow --tags + with: + fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 7cf46accc76..bac45d6bba4 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -27,10 +27,8 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Fetch git tags - run: | - git fetch --prune --unshallow --tags + with: + fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 3dd605881a7..7358eafcc90 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -21,11 +21,9 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Fetch git tags - run: | - git fetch --prune --unshallow --tags - + with: + fetch-depth: 0 + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 78f10e284ce..90c00f66397 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -37,10 +37,7 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: true - - - name: Fetch git tags - run: | - git fetch --prune --unshallow --tags + fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: From b93d66de6d15aea8744adce8d1aae88367d2814a Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Fri, 10 Jan 2025 04:36:26 +0530 Subject: [PATCH 41/53] cummulative diff Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 5afc45e6cdd..4a36446bbc7 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -32,25 +32,17 @@ runs: echo "v2_tag=$v2_tag" >> $GITHUB_ENV echo "$v2_tag" - - name: Check existing cache - id: check-cache - uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: ./.metrics/release_${{ inputs.snapshot}} - key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} - lookup-only: true - # The github cache restore successfully restores when cache saved has same key and same path. # Hence to restore release metric with name relese_{metric_name} , the name must be changed to the same. - name: Change file name before caching - if: ${{ (github.ref_name == 'main') && (steps.check-cache.outputs.cache-hit != 'true') }} + if: github.ref_name == 'main' shell: bash run: | mv ./.metrics/${{ inputs.snapshot }} ./.metrics/release_${{ inputs.snapshot}} - name: Cache scraped metrics for tagged release for longer retention id: tagged-metrics - if: ${{ (github.ref_name == 'main') && (steps.check-cache.outputs.cache-hit != 'true') }} + if: github.ref_name == 'main' uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: ./.metrics/release_${{ inputs.snapshot}} From 41693c5fdd205b367fde0d24534fb82b8ad9d8d8 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Sun, 12 Jan 2025 02:32:06 +0530 Subject: [PATCH 42/53] minor changes Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 4a36446bbc7..2de45b20c86 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -50,6 +50,7 @@ runs: - name: Download the cached tagged metrics id: download-release-snapshot + if: github.ref_name != 'main' uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: ./.metrics/release_${{ inputs.snapshot}} @@ -61,9 +62,9 @@ runs: shell: bash run: | python3 -m pip install prometheus-client - python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/cached_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} + python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/release_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} if [ $? -eq 1 ]; then - echo "Differences found in metrics" + echo "🛑 Differences found in metrics" exit 1 fi From 4ffb260c05947b592393ad15e4693ad4884ac8c5 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Mon, 13 Jan 2025 11:36:54 +0530 Subject: [PATCH 43/53] use restore key Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 2de45b20c86..3fbdc04119e 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -44,9 +44,12 @@ runs: id: tagged-metrics if: github.ref_name == 'main' uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: + with: path: ./.metrics/release_${{ inputs.snapshot}} - key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} + key: ${{ env.v2_tag }}_${{ inputs.artifact_key }}_${{ github.run_id }} + restore-keys: | + ${{ env.v2_tag }}_${{ inputs.artifact_key }}_ + - name: Download the cached tagged metrics id: download-release-snapshot @@ -54,11 +57,11 @@ runs: uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: ./.metrics/release_${{ inputs.snapshot}} - key: ${{ env.v2_tag }}_${{ inputs.artifact_key }} + key: ${{ env.v2_tag }}_${{ inputs.artifact_key }}_${{ github.run_id }} - name: Calculate diff between the snapshots id: compare-snapshots - if: steps.download-release-snapshot.outputs.cache-hit == 'true' + if: ${{ (steps.download-release-snapshot.outputs.cache-hit == 'true') && (github.ref_name != 'main') }} shell: bash run: | python3 -m pip install prometheus-client @@ -69,7 +72,7 @@ runs: fi - name: Upload the diff artifact - if: ${{ (steps.download-release-snapshot.outputs.cache-hit == 'true') && (steps.compare-snapshots.outcome == 'failure') }} + if: ${{ (github.ref_name != 'main') && (steps.compare-snapshots.outcome == 'failure') }} uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: diff_${{ inputs.artifact_key }} From 1249fdcfaf88981fcf34d0d45be25722a108c98a Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 14 Jan 2025 01:39:54 +0530 Subject: [PATCH 44/53] resolved changes Signed-off-by: chahatsagarmain --- .../verify-metrics-snapshot/action.yaml | 30 +++++++------------ .github/workflows/ci-e2e-badger.yaml | 2 +- .github/workflows/ci-e2e-cassandra.yml | 2 +- .github/workflows/ci-e2e-elasticsearch.yml | 2 +- .github/workflows/ci-e2e-grpc.yml | 2 +- .github/workflows/ci-e2e-kafka.yml | 2 +- .github/workflows/ci-e2e-memory.yaml | 2 +- .github/workflows/ci-e2e-opensearch.yml | 2 +- 8 files changed, 18 insertions(+), 26 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 3fbdc04119e..4047925e88a 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -18,37 +18,29 @@ inputs: runs: using: 'composite' steps: - - name: Upload Metrics Artifact + - name: Upload current metrics snapshot uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: ${{ inputs.artifact_key }} - path: ./.metrics/${{ inputs.snapshot }} + path: ./.metrics/${{ inputs.snapshot }}.txt retention-days: 7 - - name: Get v2 tag - shell: bash - run: | - v2_tag=$(make echo-v2) - echo "v2_tag=$v2_tag" >> $GITHUB_ENV - echo "$v2_tag" - # The github cache restore successfully restores when cache saved has same key and same path. # Hence to restore release metric with name relese_{metric_name} , the name must be changed to the same. - name: Change file name before caching if: github.ref_name == 'main' shell: bash run: | - mv ./.metrics/${{ inputs.snapshot }} ./.metrics/release_${{ inputs.snapshot}} + mv ./.metrics/${{ inputs.snapshot }}.txt ./.metrics/baseline_${{ inputs.snapshot }}.txt - name: Cache scraped metrics for tagged release for longer retention id: tagged-metrics if: github.ref_name == 'main' uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: - path: ./.metrics/release_${{ inputs.snapshot}} - key: ${{ env.v2_tag }}_${{ inputs.artifact_key }}_${{ github.run_id }} - restore-keys: | - ${{ env.v2_tag }}_${{ inputs.artifact_key }}_ + path: ./.metrics/baseline_${{ inputs.snapshot }}.txt + key: ${{ inputs.artifact_key }}_${{ github.run_id }} + restore-keys: [ ${{ inputs.artifact_key }} ] - name: Download the cached tagged metrics @@ -56,16 +48,16 @@ runs: if: github.ref_name != 'main' uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: - path: ./.metrics/release_${{ inputs.snapshot}} - key: ${{ env.v2_tag }}_${{ inputs.artifact_key }}_${{ github.run_id }} + path: ./.metrics/baseline_${{ inputs.snapshot }}.txt + key: ${{ inputs.artifact_key }} - name: Calculate diff between the snapshots id: compare-snapshots - if: ${{ (steps.download-release-snapshot.outputs.cache-hit == 'true') && (github.ref_name != 'main') }} + if: ${{ (github.ref_name != 'main') && (steps.download-release-snapshot.outputs.cache-hit == 'true') }} shell: bash run: | python3 -m pip install prometheus-client - python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }} --file2 ./.metrics/release_${{ inputs.snapshot}} --output ./.metrics/diff_${{ inputs.snapshot }} + python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }}.txt --file2 ./.metrics/baseline_${{ inputs.snapshot }}.txt --output ./.metrics/diff_${{ inputs.snapshot }}.txt if [ $? -eq 1 ]; then echo "🛑 Differences found in metrics" exit 1 @@ -76,7 +68,7 @@ runs: uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: diff_${{ inputs.artifact_key }} - path: ./.metrics/diff_${{ inputs.snapshot }} + path: ./.metrics/diff_${{ inputs.snapshot }}.txt retention-days: 7 \ No newline at end of file diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 3938dee231a..2fa85e38152 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -46,7 +46,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: matrix.version == 'v2' with: - snapshot: badger_metrics.txt + snapshot: metrics_snapshot_badger artifact_key: badger-metrics-${{ matrix.version }}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 01d1e430e97..1b6d2bd5657 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -54,7 +54,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: matrix.jaeger-version == 'v2' with: - snapshot: cassandra_metrics.txt + snapshot: metrics_snapshot_cassandra artifact_key: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index ba28fc33642..51a766c219a 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -59,7 +59,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: matrix.version.jaeger == 'v2' with: - snapshot: elasticsearch_metrics.txt + snapshot: metrics_snapshot_elasticsearch artifact_key: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index e31f45a9cf7..658f39e7caf 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -46,7 +46,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: matrix.version == 'v2' with: - snapshot: grpc_metrics.txt + snapshot: metrics_snapshot_grpc_metrics artifact_key: grpc-metrics-${{ matrix.version }}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index bac45d6bba4..b8101f3546e 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -41,7 +41,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: matrix.jaeger-version == 'v2' with: - snapshot: kafka_metrics.txt + snapshot: metrics_snapshot_kafka artifact_key: kafka-metrics-${{ matrix.jaeger-version }}.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 7358eafcc90..8a5ed4fb1aa 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -34,7 +34,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot with: - snapshot: memory_metrics.txt + snapshot: metrics_snapshot_memory artifact_key: memory-metrics.txt - name: Upload coverage to codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 90c00f66397..9b8ed28901d 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -52,7 +52,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: matrix.version.jaeger == 'v2' with: - snapshot: opensearch_metrics.txt + snapshot: metrics_snapshot_opensearch artifact_key: opensearch-metrics-${{ matrix.version.major }}.txt - name: Upload coverage to codecov From 98968eb687b3671c779c50b3e09a41e38fd9c15b Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 14 Jan 2025 01:50:42 +0530 Subject: [PATCH 45/53] fix Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 4047925e88a..31ab4fa831e 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -40,7 +40,7 @@ runs: with: path: ./.metrics/baseline_${{ inputs.snapshot }}.txt key: ${{ inputs.artifact_key }}_${{ github.run_id }} - restore-keys: [ ${{ inputs.artifact_key }} ] + restore-keys: ${{ inputs.artifact_key }} - name: Download the cached tagged metrics From e43b1e3b98959251eed50e5d094bffa5036d9208 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 14 Jan 2025 01:56:23 +0530 Subject: [PATCH 46/53] fix Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-grpc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 658f39e7caf..d474c01d932 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -46,7 +46,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot if: matrix.version == 'v2' with: - snapshot: metrics_snapshot_grpc_metrics + snapshot: metrics_snapshot_grpc artifact_key: grpc-metrics-${{ matrix.version }}.txt - name: Upload coverage to codecov From af10a818f797c0fbcbffb47b2778625a490af124 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 14 Jan 2025 16:45:04 +0530 Subject: [PATCH 47/53] change save path Signed-off-by: chahatsagarmain --- cmd/jaeger/internal/integration/e2e_integration.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index 59f566cb114..a86bbac6522 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -117,7 +117,7 @@ func scrapeMetrics(t *testing.T, storage string) { outputDir := "../../../../.metrics" require.NoError(t, os.MkdirAll(outputDir, os.ModePerm)) - metricsFile, err := os.Create(fmt.Sprintf("%s/%v_metrics.txt", outputDir, storage)) + metricsFile, err := os.Create(fmt.Sprintf("%s/metrics_snapshot_%v.txt", outputDir, storage)) require.NoError(t, err) defer metricsFile.Close() From b29098a0b52f5074ee18d68e8479ef355823fc5d Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Tue, 14 Jan 2025 18:42:43 +0530 Subject: [PATCH 48/53] fix restore keys Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 31ab4fa831e..465a13c50de 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -40,9 +40,9 @@ runs: with: path: ./.metrics/baseline_${{ inputs.snapshot }}.txt key: ${{ inputs.artifact_key }}_${{ github.run_id }} - restore-keys: ${{ inputs.artifact_key }} - - + + # Use restore keys to match prefix and fetch the latest cache + # Here , restore keys is an ordered list of prefixes that need to be matched - name: Download the cached tagged metrics id: download-release-snapshot if: github.ref_name != 'main' @@ -50,6 +50,8 @@ runs: with: path: ./.metrics/baseline_${{ inputs.snapshot }}.txt key: ${{ inputs.artifact_key }} + restore-keys: | + ${{ inputs.artifact_key }} - name: Calculate diff between the snapshots id: compare-snapshots From 5e2eac13f1384d71dd4e80333ee77583b55dc1e7 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Wed, 15 Jan 2025 22:29:15 +0530 Subject: [PATCH 49/53] minor change in name Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-badger.yaml | 2 +- .github/workflows/ci-e2e-cassandra.yml | 2 +- .github/workflows/ci-e2e-elasticsearch.yml | 2 +- .github/workflows/ci-e2e-grpc.yml | 2 +- .github/workflows/ci-e2e-kafka.yml | 2 +- .github/workflows/ci-e2e-memory.yaml | 2 +- .github/workflows/ci-e2e-opensearch.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 2fa85e38152..489dfec216c 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -47,7 +47,7 @@ jobs: if: matrix.version == 'v2' with: snapshot: metrics_snapshot_badger - artifact_key: badger-metrics-${{ matrix.version }}.txt + artifact_key: metrics_snapshot_badger_${{ matrix.version }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index 1b6d2bd5657..d972cfa0fbf 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -55,7 +55,7 @@ jobs: if: matrix.jaeger-version == 'v2' with: snapshot: metrics_snapshot_cassandra - artifact_key: cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}.txt + artifact_key: metrics_snapshot_cassandras_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 51a766c219a..18aca99bf81 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -60,7 +60,7 @@ jobs: if: matrix.version.jaeger == 'v2' with: snapshot: metrics_snapshot_elasticsearch - artifact_key: elasticsearch-metrics-${{ matrix.version.major }}_${{ matrix.version.jaeger}}.txt + artifact_key: metrics_snapshot_elasticsearch_${{ matrix.version.major }}_${{ matrix.version.jaeger}} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index d474c01d932..228e85243f1 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -47,7 +47,7 @@ jobs: if: matrix.version == 'v2' with: snapshot: metrics_snapshot_grpc - artifact_key: grpc-metrics-${{ matrix.version }}.txt + artifact_key: metrics_snapshot_grpc_${{ matrix.version }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index b8101f3546e..d47c3b9903b 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -42,7 +42,7 @@ jobs: if: matrix.jaeger-version == 'v2' with: snapshot: metrics_snapshot_kafka - artifact_key: kafka-metrics-${{ matrix.jaeger-version }}.txt + artifact_key: metrics_snapshot_kafka_${{ matrix.jaeger-version }}.txt - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 8a5ed4fb1aa..526ddb02335 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -35,7 +35,7 @@ jobs: - uses: ./.github/actions/verify-metrics-snapshot with: snapshot: metrics_snapshot_memory - artifact_key: memory-metrics.txt + artifact_key: metrics_snapshot_memory - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 9b8ed28901d..4972a199773 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -53,7 +53,7 @@ jobs: if: matrix.version.jaeger == 'v2' with: snapshot: metrics_snapshot_opensearch - artifact_key: opensearch-metrics-${{ matrix.version.major }}.txt + artifact_key: metrics_snapshot_opensearch_${{ matrix.version.major }}.txt - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov From b6bd4c0b3fcdf4a4dd84d6b8b63da05bd70a765e Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Wed, 15 Jan 2025 22:55:53 +0530 Subject: [PATCH 50/53] remove txt Signed-off-by: chahatsagarmain --- .github/workflows/ci-e2e-kafka.yml | 2 +- .github/workflows/ci-e2e-opensearch.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index d47c3b9903b..688918b45c2 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -42,7 +42,7 @@ jobs: if: matrix.jaeger-version == 'v2' with: snapshot: metrics_snapshot_kafka - artifact_key: metrics_snapshot_kafka_${{ matrix.jaeger-version }}.txt + artifact_key: metrics_snapshot_kafka_${{ matrix.jaeger-version }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 4972a199773..22d748ae63c 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -53,7 +53,7 @@ jobs: if: matrix.version.jaeger == 'v2' with: snapshot: metrics_snapshot_opensearch - artifact_key: metrics_snapshot_opensearch_${{ matrix.version.major }}.txt + artifact_key: metrics_snapshot_opensearch_${{ matrix.version.major }} - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov From 9dad77986065778256dc95008e528057fa520e96 Mon Sep 17 00:00:00 2001 From: chahatsagarmain Date: Thu, 16 Jan 2025 21:44:30 +0530 Subject: [PATCH 51/53] minor changes Signed-off-by: chahatsagarmain --- .github/actions/verify-metrics-snapshot/action.yaml | 8 ++------ .github/workflows/ci-e2e-badger.yaml | 2 -- .github/workflows/ci-e2e-cassandra.yml | 2 -- .github/workflows/ci-e2e-elasticsearch.yml | 1 - .github/workflows/ci-e2e-grpc.yml | 2 -- .github/workflows/ci-e2e-kafka.yml | 2 -- .github/workflows/ci-e2e-memory.yaml | 2 -- .github/workflows/ci-e2e-opensearch.yml | 1 - 8 files changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 465a13c50de..4b98aed0e17 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -12,9 +12,6 @@ inputs: artifact_key: description: 'Artifact key used for uploading and fetching artifacts' required: true - cache_key: - description: 'Cache key used for uploading and fetching the correct cached metric' - required: true runs: using: 'composite' steps: @@ -33,8 +30,7 @@ runs: run: | mv ./.metrics/${{ inputs.snapshot }}.txt ./.metrics/baseline_${{ inputs.snapshot }}.txt - - name: Cache scraped metrics for tagged release for longer retention - id: tagged-metrics + - name: Cache metrics snapshot on main branch for longer retention if: github.ref_name == 'main' uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: @@ -55,7 +51,7 @@ runs: - name: Calculate diff between the snapshots id: compare-snapshots - if: ${{ (github.ref_name != 'main') && (steps.download-release-snapshot.outputs.cache-hit == 'true') }} + if: ${{ (github.ref_name != 'main') && (steps.download-release-snapshot.outputs.cache-matched-key != '') }} shell: bash run: | python3 -m pip install prometheus-client diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 489dfec216c..6682c4c6980 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -25,8 +25,6 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: diff --git a/.github/workflows/ci-e2e-cassandra.yml b/.github/workflows/ci-e2e-cassandra.yml index d972cfa0fbf..6ddb129c396 100644 --- a/.github/workflows/ci-e2e-cassandra.yml +++ b/.github/workflows/ci-e2e-cassandra.yml @@ -38,8 +38,6 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: diff --git a/.github/workflows/ci-e2e-elasticsearch.yml b/.github/workflows/ci-e2e-elasticsearch.yml index 18aca99bf81..2510026cb4b 100644 --- a/.github/workflows/ci-e2e-elasticsearch.yml +++ b/.github/workflows/ci-e2e-elasticsearch.yml @@ -40,7 +40,6 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: true - fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: diff --git a/.github/workflows/ci-e2e-grpc.yml b/.github/workflows/ci-e2e-grpc.yml index 228e85243f1..bea28085eec 100644 --- a/.github/workflows/ci-e2e-grpc.yml +++ b/.github/workflows/ci-e2e-grpc.yml @@ -25,8 +25,6 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 688918b45c2..b7f1c796ddd 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -27,8 +27,6 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: diff --git a/.github/workflows/ci-e2e-memory.yaml b/.github/workflows/ci-e2e-memory.yaml index 526ddb02335..d615487f532 100644 --- a/.github/workflows/ci-e2e-memory.yaml +++ b/.github/workflows/ci-e2e-memory.yaml @@ -21,8 +21,6 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: diff --git a/.github/workflows/ci-e2e-opensearch.yml b/.github/workflows/ci-e2e-opensearch.yml index 22d748ae63c..1e1405a604e 100644 --- a/.github/workflows/ci-e2e-opensearch.yml +++ b/.github/workflows/ci-e2e-opensearch.yml @@ -37,7 +37,6 @@ jobs: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: true - fetch-depth: 0 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: From be73e93289f36663b004b34b867ba3b7cc89ebbd Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Thu, 16 Jan 2025 13:20:44 -0500 Subject: [PATCH 52/53] Update .github/workflows/ci-e2e-badger.yaml Signed-off-by: Yuri Shkuro --- .github/workflows/ci-e2e-badger.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-e2e-badger.yaml b/.github/workflows/ci-e2e-badger.yaml index 6682c4c6980..000aec55847 100644 --- a/.github/workflows/ci-e2e-badger.yaml +++ b/.github/workflows/ci-e2e-badger.yaml @@ -25,7 +25,6 @@ jobs: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 1.23.x From f3b63e98c3237f9abeebfe352370f70091cd5a6a Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Thu, 16 Jan 2025 13:21:58 -0500 Subject: [PATCH 53/53] Update .github/actions/verify-metrics-snapshot/action.yaml Signed-off-by: Yuri Shkuro --- .github/actions/verify-metrics-snapshot/action.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/actions/verify-metrics-snapshot/action.yaml b/.github/actions/verify-metrics-snapshot/action.yaml index 4b98aed0e17..5319f587a54 100644 --- a/.github/actions/verify-metrics-snapshot/action.yaml +++ b/.github/actions/verify-metrics-snapshot/action.yaml @@ -1,8 +1,6 @@ # Copyright (c) 2023 The Jaeger Authors. # SPDX-License-Identifier: Apache-2.0 - - name: 'Verify Metric Snapshot and Upload Metrics' description: 'Upload or cache the metrics data after verification' inputs: