Skip to content

Commit

Permalink
Updated ISPN Metrics calculation to include xsite latency per run
Browse files Browse the repository at this point in the history
Closes #636

Signed-off-by: Anna Manukyan <[email protected]>
Co-authored-by: Anna Manukyan <[email protected]>
  • Loading branch information
andyuk1986 and Anna Manukyan committed May 2, 2024
1 parent b280a6c commit 547f745
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 24 deletions.
41 changes: 31 additions & 10 deletions .github/actions/prometheus-metrics-calc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
20 changes: 10 additions & 10 deletions .github/actions/prometheus-run-queries/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 }}
5 changes: 1 addition & 4 deletions .github/workflows/rosa-scaling-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -239,7 +239,6 @@ jobs:
with:
project: ${{ env.PROJECT }}
runMemoryUsageTotal: true
ispnMetrics: true
output: memory_create_sessions

- name: Calculate number of active sessions
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 547f745

Please sign in to comment.