@@ -22,6 +22,8 @@ RHDH_NAMESPACE=${RHDH_NAMESPACE:-rhdh-performance}
2222ENABLE_PROFILING=" ${ENABLE_PROFILING:- false} "
2323RHDH_INSTALL_METHOD=" ${RHDH_INSTALL_METHOD:- helm} "
2424LOCUST_NAMESPACE=" ${LOCUST_NAMESPACE:- locust-operator} "
25+ RHDH_METRIC=" ${RHDH_METRIC:- true} "
26+ PSQL_EXPORT=" ${PSQL_EXPORT:- false} "
2527
2628cli=" oc"
2729clin=" $cli -n $RHDH_NAMESPACE "
@@ -36,7 +38,7 @@ gather_pod_logs() {
3638 for pod in $pods ; do
3739 echo " $pod "
3840 containers=$( $cli -n " $namespace " get pod " $pod " -o json | jq -r ' .spec.containers[].name' )
39- if $cli -n " $namespace " get pod " $pod " -o json | jq -e ' .spec.initContainers? // empty' > /dev/null; then
41+ if $cli -n " $namespace " get pod " $pod " -o json | jq -e ' .spec.initContainers? // empty' > /dev/null; then
4042 init_containers=$( $cli -n " $namespace " get pod " $pod " -o json | jq -r ' .spec.initContainers[].name // empty' )
4143 else
4244 init_containers=" "
@@ -65,6 +67,11 @@ for label in app.kubernetes.io/name=developer-hub app.kubernetes.io/name=postgre
6567done
6668gather_pod_logs " ${ARTIFACT_DIR} /rhdh-logs" " $pods " " $RHDH_NAMESPACE "
6769
70+ if [ " $ENABLE_ORCHESTRATOR " == " true" ]; then
71+ pods=$( $clin get pods -l app.kubernetes.io/component=serverless-workflow -o jsonpath=' {.items[*].metadata.name}' )
72+ gather_pod_logs " ${ARTIFACT_DIR} /workflow-logs" " $pods " " $RHDH_NAMESPACE "
73+ fi
74+
6875monitoring_collection_data=$ARTIFACT_DIR /benchmark.json
6976monitoring_collection_log=$ARTIFACT_DIR /monitoring-collection.log
7077monitoring_collection_dir=$ARTIFACT_DIR /monitoring-collection-raw-data-dir
@@ -112,6 +119,7 @@ try_gather_file "${TMP_DIR}/rbac-config.yaml"
112119try_gather_file " ${TMP_DIR} /locust-k8s-operator.values.yaml"
113120try_gather_file load-test.log
114121try_gather_file postgresql.log
122+ try_gather_dir " ${TMP_DIR} /workflows"
115123
116124# Metrics
117125PYTHON_VENV_DIR=.venv
@@ -140,6 +148,23 @@ timestamp_diff() {
140148 python3 -c " from datetime import datetime; st = datetime.strptime('$started ', '%Y-%m-%d %H:%M:%S.%f%z'); et = datetime.strptime('$ended ', '%Y-%m-%d %H:%M:%S.%f%z'); diff = et - st; print(f'{diff.total_seconds():.9f}')"
141149}
142150
151+ metrics_config_dir=" ${ARTIFACT_DIR} /metrics-config"
152+ mkdir -p " $metrics_config_dir "
153+
154+ collect_additional_metrics () {
155+ echo " $( date -u -Ins) Collecting metrics from $1 "
156+ status_data.py \
157+ --status-data-file " $monitoring_collection_data " \
158+ --additional " $1 " \
159+ --monitoring-start " $mstart " \
160+ --monitoring-end " $mend " \
161+ --monitoring-raw-data-dir " $monitoring_collection_dir " \
162+ --prometheus-host " https://$mhost " \
163+ --prometheus-port 443 \
164+ --prometheus-token " $( $cli whoami -t) " \
165+ -d >> " $monitoring_collection_log " 2>&1
166+ }
167+
143168# populate phase
144169if [ " $PRE_LOAD_DB " == " true" ]; then
145170 start_ts=" $( cat " ${ARTIFACT_DIR} /populate-before" ) "
@@ -163,7 +188,7 @@ if [ "$PRE_LOAD_DB" == "true" ]; then
163188 populate_catalog_started=$( cat " ${ARTIFACT_DIR} /populate-catalog-before" )
164189 populate_catalog_ended=$( cat " ${ARTIFACT_DIR} /populate-catalog-after" )
165190 populate_catalog_duration=" $( timestamp_diff " $populate_catalog_started " " $populate_catalog_ended " ) "
166-
191+ echo " $( date -u -Ins ) Collecting Populate phase metrics "
167192 status_data.py \
168193 --status-data-file " $monitoring_collection_data " \
169194 --set \
@@ -180,16 +205,20 @@ if [ "$PRE_LOAD_DB" == "true" ]; then
180205 measurements.timings.populate_catalog.ended=" $populate_catalog_ended " \
181206 measurements.timings.populate_catalog.duration=" $populate_catalog_duration " \
182207 -d > " $monitoring_collection_log " 2>&1
183- status_data.py \
184- --status-data-file " $monitoring_collection_data " \
185- --additional config/cluster_read_config.populate.yaml \
186- --monitoring-start " $mstart " \
187- --monitoring-end " $mend " \
188- --monitoring-raw-data-dir " $monitoring_collection_dir " \
189- --prometheus-host " https://$mhost " \
190- --prometheus-port 443 \
191- --prometheus-token " $( $cli whoami -t) " \
192- -d >> " $monitoring_collection_log " 2>&1
208+ envsubst < config/cluster_read_config.populate.yaml > " ${metrics_config_dir} /cluster_read_config.populate.yaml"
209+ collect_additional_metrics " ${metrics_config_dir} /cluster_read_config.populate.yaml"
210+ if [ " $PSQL_EXPORT " == " true" ]; then
211+ echo " $( date -u -Ins) Collecting Postgresql specific metrics (populate)"
212+ envsubst < config/cluster_read_config.populate.postgresql.yaml > " ${metrics_config_dir} /cluster_read_config.populate.postgresql.yaml"
213+ collect_additional_metrics " ${metrics_config_dir} /cluster_read_config.populate.postgresql.yaml" " $monitoring_collection_data "
214+ fi
215+ # NodeJS specific metrics
216+ if [ " $RHDH_METRIC " == " true" ]; then
217+ echo " $( date -u -Ins) Collecting NodeJS specific metrics (populate)"
218+ envsubst < config/cluster_read_config.populate.nodejs.yaml > " ${metrics_config_dir} /cluster_read_config.populate.nodejs.yaml"
219+ collect_additional_metrics " ${metrics_config_dir} /cluster_read_config.populate.nodejs.yaml"
220+ fi
221+
193222fi
194223# test phase
195224start_ts=" $( cat " ${ARTIFACT_DIR} /benchmark-before" ) "
@@ -201,6 +230,7 @@ mhost=$(kubectl -n openshift-monitoring get route -l app.kubernetes.io/name=than
201230mversion=$( sed -n ' s/^__version__ = "\(.*\)"/\1/p' " scenarios/$( cat " ${ARTIFACT_DIR} /benchmark-scenario" ) .py" )
202231benchmark_started=$( cat " ${ARTIFACT_DIR} /benchmark-before" )
203232benchmark_ended=$( cat " ${ARTIFACT_DIR} /benchmark-after" )
233+ echo " $( date -u -Ins) Collecting Test phase metrics"
204234status_data.py \
205235 --status-data-file " $monitoring_collection_data " \
206236 --set \
@@ -211,28 +241,26 @@ status_data.py \
211241 metadata.scenario.name=" $( cat " ${ARTIFACT_DIR} /benchmark-scenario" ) " \
212242 metadata.scenario.version=" $mversion " \
213243 -d > " $monitoring_collection_log " 2>&1
214- status_data.py \
215- --status-data-file " $monitoring_collection_data " \
216- --additional config/cluster_read_config.test.yaml \
217- --monitoring-start " $mstart " \
218- --monitoring-end " $mend " \
219- --monitoring-raw-data-dir " $monitoring_collection_dir " \
220- --prometheus-host " https://$mhost " \
221- --prometheus-port 443 \
222- --prometheus-token " $( $cli whoami -t) " \
223- -d >> " $monitoring_collection_log " 2>&1
244+ envsubst < config/cluster_read_config.test.yaml > " ${metrics_config_dir} /cluster_read_config.test.yaml"
245+ collect_additional_metrics " ${metrics_config_dir} /cluster_read_config.test.yaml"
224246# Scenario specific metrics
225- if [ -f " scenarios/$( cat " ${ARTIFACT_DIR} /benchmark-scenario" ) .metrics.yaml" ]; then
226- status_data.py \
227- --status-data-file " $monitoring_collection_data " \
228- --additional " scenarios/$( cat " ${ARTIFACT_DIR} /benchmark-scenario" ) .metrics.yaml" \
229- --monitoring-start " $mstart " \
230- --monitoring-end " $mend " \
231- --monitoring-raw-data-dir " $monitoring_collection_dir " \
232- --prometheus-host " https://$mhost " \
233- --prometheus-port 443 \
234- --prometheus-token " $( $cli whoami -t) " \
235- -d >> " $monitoring_collection_log " 2>&1
247+ echo " $( date -u -Ins) Collecting Scenario specific metrics"
248+ benchmark_scenario=$( cat " ${ARTIFACT_DIR} /benchmark-scenario" )
249+ if [ -f " scenarios/$benchmark_scenario .metrics.yaml" ]; then
250+ envsubst < " scenarios/$benchmark_scenario .metrics.yaml" > " ${metrics_config_dir} /$benchmark_scenario .metrics.yaml"
251+ collect_additional_metrics " ${metrics_config_dir} /$benchmark_scenario .metrics.yaml"
252+ fi
253+ # Postgresql specific metrics
254+ if [ " $PSQL_EXPORT " == " true" ]; then
255+ echo " $( date -u -Ins) Collecting Postgresql specific metrics (test)"
256+ envsubst < config/cluster_read_config.test.postgresql.yaml > " ${metrics_config_dir} /cluster_read_config.test.postgresql.yaml"
257+ collect_additional_metrics " ${metrics_config_dir} /cluster_read_config.test.postgresql.yaml"
258+ fi
259+ # NodeJS specific metrics
260+ if [ " $RHDH_METRIC " == " true" ]; then
261+ echo " $( date -u -Ins) Collecting NodeJS specific metrics (test)"
262+ envsubst < config/cluster_read_config.test.nodejs.yaml > " ${metrics_config_dir} /cluster_read_config.test.nodejs.yaml"
263+ collect_additional_metrics " ${metrics_config_dir} /cluster_read_config.test.nodejs.yaml"
236264fi
237265set +u
238266deactivate
@@ -254,8 +282,10 @@ if [ "$RHDH_INSTALL_METHOD" == "helm" ] && ${ENABLE_PROFILING}; then
254282 $clin exec " $pod " -c backstage-backend -- /bin/bash -c ' find /opt/app-root/src -name "*.heapsnapshot" -exec base64 -w0 {} \;' | base64 -d > " $memory_profile_file "
255283fi
256284
285+ echo " $( date -u -Ins) Generating summary CSV"
257286./ci-scripts/runs-to-csv.sh " $ARTIFACT_DIR " > " $ARTIFACT_DIR /summary.csv"
258287
288+ echo " $( date -u -Ins) Collecting error reports"
259289# Error report
260290find " $ARTIFACT_DIR " -name load-test.log -print0 | sort -V | while IFS= read -r file; do
261291 if grep " Error report" " $file " > /dev/null; then
0 commit comments