From 547f74592b42469cf480436be7c4c2e927057c36 Mon Sep 17 00:00:00 2001 From: andyuk1986 Date: Thu, 2 May 2024 16:31:00 +0200 Subject: [PATCH] Updated ISPN Metrics calculation to include xsite latency per run Closes #636 Signed-off-by: Anna Manukyan Co-authored-by: Anna Manukyan --- .../prometheus-metrics-calc/action.yml | 41 ++++++++++++++----- .../actions/prometheus-run-queries/action.yml | 20 ++++----- .github/workflows/rosa-scaling-benchmark.yml | 5 +-- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/.github/actions/prometheus-metrics-calc/action.yml b/.github/actions/prometheus-metrics-calc/action.yml index 3c38b21cb..43d65d035 100644 --- a/.github/actions/prometheus-metrics-calc/action.yml +++ b/.github/actions/prometheus-metrics-calc/action.yml @@ -25,6 +25,9 @@ inputs: default: '3' measurementInterval: description: 'A specific time period over which we want to calculate the required metrics.' + ispnCacheName: + description: 'ISPN cache name for which we need to calculate metrics.' + default: 'sessions' runs: using: composite @@ -88,6 +91,34 @@ runs: --arg val ${CALCULATED_METRIC_VALUE} '. + {($testName): {($key):($val|tonumber)}}' ${HORREUM_OUTPUT_FILE_NAME} > tmp.json && \ mv tmp.json ${HORREUM_OUTPUT_FILE_NAME} + - id: calculate-ispn-metric-and-store + name: Calculated the ISPN metric and stores it in horreum json file. + env: + HORREUM_OUTPUT_FILE_NAME: ${{ env.HORREUM_OUTPUT_FILE_NAME }} + shell: bash + # language=bash + run: | + #Reading ispn metrics file with xsite reqs data + readarray -t lines < "${{ inputs.ispnCacheName}}_ispn_metrics_file_count" + num1=${lines[0]} + num2=${lines[1]} + #calculating the number of xsite requests during the test execution + xsite_reqs=$(awk "BEGIN {print ($num2-$num1); exit}") + #Reading ispn metrics file with xsite reqs totad duration + readarray -t lines1 < "${{ inputs.ispnCacheName}}_ispn_metrics_file_sum" + num1=${lines1[0]} + num2=${lines1[1]} + #calculating the number of xsite requests during the test execution + xsite_reqs_total_duration=$(awk "BEGIN {print ($num2-$num1); exit}") + #calculating the average duration per request in ms + averageXsiteReplicationTimePerReq=$(awk "BEGIN {print int($xsite_reqs_total_duration*1000/$xsite_reqs); exit}") + #Putting metric into JSON + jq --arg cacheName "${{ inputs.ispnCacheName}}" --arg val "${averageXsiteReplicationTimePerReq}" --arg testName "${{ inputs.performedTestName }}" \ + '.[$testName].ispnStatistics |= .+ {"cacheName": ($cacheName), "averageXsiteReplicationTime":($val|tonumber)}' ${HORREUM_OUTPUT_FILE_NAME} > tmp.json && \ + mv tmp.json ${HORREUM_OUTPUT_FILE_NAME} + #Removing ispn metrics file for next execution + rm "${{ inputs.ispnCacheName}}_ispn_metrics_file_count" + - id: gatling-report-parse-and-store name: Parses gatling report and stores got information in JSON file. env: @@ -103,13 +134,3 @@ runs: jq --argjson statsJson "${statsJson}" --arg testName "${{ inputs.performedTestName }}" \ '.[$testName].statistics |= .+ ($statsJson)' ${HORREUM_OUTPUT_FILE_NAME} > tmp.json && \ mv tmp.json ${HORREUM_OUTPUT_FILE_NAME} - #Reading ispn metrics file - readarray -t lines < ispn_metrics_file - for i in "${lines[@]}" - do - IFS=',' read -ra metric <<< "$i" - #Putting metric into JSON - jq --arg cacheName "${metric[0]}" --arg val "${metric[1]}" --arg testName "${{ inputs.performedTestName }}" \ - '.[$testName].ispnStatistics |= .+ {"cacheName": ($cacheName), "averageXsiteReplicationTime":($val|tonumber)}' ${HORREUM_OUTPUT_FILE_NAME} > tmp.json && \ - mv tmp.json ${HORREUM_OUTPUT_FILE_NAME} - done diff --git a/.github/actions/prometheus-run-queries/action.yml b/.github/actions/prometheus-run-queries/action.yml index 4bf7d7eaf..1346465df 100644 --- a/.github/actions/prometheus-run-queries/action.yml +++ b/.github/actions/prometheus-run-queries/action.yml @@ -11,9 +11,9 @@ inputs: runMemoryUsageTotal: description: 'Identifies if "Memory Usage Total" query should be run.' default: 'false' - ispnMetrics: - description: 'Identifies if ISPN metrics should be retrieved.' - default: 'false' + ispnCacheName: + description: 'The name of the cache for which metrics should be retrieved.' + default: 'sessions' output: description: 'The name of the output to store data in' default: 'out' @@ -58,16 +58,16 @@ runs: OC_TOKEN: ${{ env.OC_TOKEN }} - id: ispn-metrics - name: ISPN response information - if: ${{ inputs.ispnMetrics == 'true' }} + name: ISPN average xsite repl time shell: bash # language=bash run: | - cacheName="sessions" - ispnMetric=$(curl -s -H "Authorization: Bearer $OC_TOKEN" -k "https://$THANOS_HOST/api/v1/query" --data-urlencode \ - "query=avg(vendor_rpc_manager_average_xsite_replication_time{job='infinispan-admin', namespace='${{ inputs.project }}',container='infinispan', cache='$cacheName'})" \ - | jq '.data.result[0].value[1]' -r) - echo "${cacheName},${ispnMetric}" >> ispn_metrics_file + curl -s -H "Authorization: Bearer $OC_TOKEN" -k "https://$THANOS_HOST/api/v1/query" --data-urlencode \ + "query=avg(vendor_rpc_manager_cross_site_replication_times_seconds_sum{job='infinispan-admin', namespace='${{ inputs.project }}',container='infinispan', cache='${{ inputs.ispnCacheName }}'})" \ + | jq '.data.result[0].value[1]' -r >> "${{ inputs.ispnCacheName}}_ispn_metrics_file_sum" + curl -s -H "Authorization: Bearer $OC_TOKEN" -k "https://$THANOS_HOST/api/v1/query" --data-urlencode \ + "query=avg(vendor_rpc_manager_cross_site_replication_times_seconds_count{job='infinispan-admin', namespace='${{ inputs.project }}',container='infinispan', cache='${{ inputs.ispnCacheName }}'})" \ + | jq '.data.result[0].value[1]' -r >> "${{ inputs.ispnCacheName}}_ispn_metrics_file_count" env: THANOS_HOST: ${{ env.THANOS_HOST }} OC_TOKEN: ${{ env.OC_TOKEN }} diff --git a/.github/workflows/rosa-scaling-benchmark.yml b/.github/workflows/rosa-scaling-benchmark.yml index 1aeaa729b..e5fea13fc 100644 --- a/.github/workflows/rosa-scaling-benchmark.yml +++ b/.github/workflows/rosa-scaling-benchmark.yml @@ -6,7 +6,7 @@ on: clusterName: description: 'Name of the cluster' type: string - default: 'gh-keycloak' + default: 'gh-keycloak-a' region: description: 'Name of the region where EC2 instances should be installed' type: string @@ -239,7 +239,6 @@ jobs: with: project: ${{ env.PROJECT }} runMemoryUsageTotal: true - ispnMetrics: true output: memory_create_sessions - name: Calculate number of active sessions @@ -288,7 +287,6 @@ jobs: with: project: ${{ env.PROJECT }} runCpuSecsUtil: true - ispnMetrics: true output: user_logins_vCpu - name: Calculate and Store CPU sec Util For Ran Benchmark @@ -330,7 +328,6 @@ jobs: with: project: ${{ env.PROJECT }} runCpuSecsUtil: true - ispnMetrics: true output: client_credential_grants_vCpu - name: Calculate and Store CPU usage For Ran Benchmark