diff --git a/Makefile b/Makefile index 663a7d7..c6706d1 100644 --- a/Makefile +++ b/Makefile @@ -192,6 +192,7 @@ endif @echo "Getting locust master log:" kubectl logs --namespace $(LOCUST_NAMESPACE) -f -l performance-test-pod-name=$(SCENARIO)-test-master | tee load-test.log date --utc -Ins>$(TMP_DIR)/benchmark-after + oc exec rhdh-postgresql-primary-0 -n rhdh-performance -- sh -c 'cat /var/lib/pgsql/data/userdata/log/postgresql*.log' | grep duration > postgresql.log @echo "All done!!!" ## Run the scalability test diff --git a/ci-scripts/collect-results.sh b/ci-scripts/collect-results.sh index 9c8fa26..65070d4 100755 --- a/ci-scripts/collect-results.sh +++ b/ci-scripts/collect-results.sh @@ -70,6 +70,7 @@ try_gather_file "${TMP_DIR}/create_group.log" try_gather_file "${TMP_DIR}/create_user.log" try_gather_file "${TMP_DIR}/get_token.log" try_gather_file load-test.log +try_gather_file postgresql.log PYTHON_VENV_DIR=.venv diff --git a/ci-scripts/rhdh-setup/deploy.sh b/ci-scripts/rhdh-setup/deploy.sh index 8a9f3b6..ee71d94 100755 --- a/ci-scripts/rhdh-setup/deploy.sh +++ b/ci-scripts/rhdh-setup/deploy.sh @@ -54,6 +54,11 @@ export KEYCLOAK_USER_PASS=${KEYCLOAK_USER_PASS:-$(mktemp -u XXXXXXXXXX)} export AUTH_PROVIDER="${AUTH_PROVIDER:-''}" export ENABLE_RBAC="${ENABLE_RBAC:-false}" +export PSQL_LOG="${PSQL_LOG:-true}" +export LOG_MIN_DURATION_STATEMENT="${LOG_MIN_DURATION_STATEMENT:-65}" +export LOG_MIN_DURATION_SAMPLE="${LOG_MIN_DURATION_SAMPLE:-50}" +export LOG_STATEMENT_SAMPLE_RATE="${LOG_STATEMENT_SAMPLE_RATE:-0.7}" + export INSTALL_METHOD=helm TMP_DIR=$(readlink -m "${TMP_DIR:-.tmp}") @@ -115,6 +120,7 @@ install() { fi backstage_install + psql_debug setup_monitoring } @@ -240,6 +246,16 @@ install_rhdh_with_olm() { wait_to_start deployment "backstage-developer-hub" 300 300 } +# shellcheck disable=SC2016,SC1001,SC2086 +psql_debug() { + if ${PSQL_LOG}; then + oc exec rhdh-postgresql-primary-0 -n "${RHDH_NAMESPACE}" -- sh -c "sed -i "s/^\s*#log_min_duration_statement.*/log_min_duration_statement=${LOG_MIN_DURATION_STATEMENT}/" /var/lib/pgsql/data/userdata/postgresql.conf " + oc exec rhdh-postgresql-primary-0 -n "${RHDH_NAMESPACE}" -- sh -c "sed -i "s/^\s*#log_min_duration_sample.*/log_min_duration_sample=${LOG_MIN_DURATION_SAMPLE}/" /var/lib/pgsql/data/userdata/postgresql.conf " + oc exec rhdh-postgresql-primary-0 -n "${RHDH_NAMESPACE}" -- sh -c "sed -i "s/^\s*#log_statement_sample_rate.*/log_statement_sample_rate=${LOG_STATEMENT_SAMPLE_RATE}/" /var/lib/pgsql/data/userdata/postgresql.conf " + fi + oc exec rhdh-postgresql-primary-0 -n "${RHDH_NAMESPACE}" -- sh -c 'pg_ctl -D $PGDATA restart -mf' +} + setup_monitoring() { echo "Enabling user workload monitoring" rm -f config.yaml