Skip to content

Commit

Permalink
[Test] Write Prometheus stats to driver log. (#367)
Browse files Browse the repository at this point in the history
Write Prometheus stats to driver log, in addition to worker stats, even
when not saving data to BigQuery.
  • Loading branch information
paulosjca authored Jul 31, 2023
1 parent e9653db commit 3cc5171
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions containers/runtime/driver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ RUN pip3 install \
COPY . /src/driver
RUN chmod a+x /src/driver/run.sh

# TODO(paulosjca): Remove this when prometheus.py is executable at driver commit.
RUN chmod a+x /src/code/tools/run_tests/performance/prometheus.py

ENV QPS_WORKERS=""
ENV QPS_WORKERS_FILE=""
ENV SCENARIOS_FILE="/src/driver/example.json"
Expand Down
20 changes: 11 additions & 9 deletions containers/runtime/driver/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,22 @@ fi

/src/code/bazel-bin/test/cpp/qps/qps_json_driver --quit=true

if [ -n "${SERVER_TARGET_OVERRIDE}" ] || [ -n "${ENABLE_PROMETHEUS}" ]; then
if [ "$(dig +short -t srv prometheus.test-infra-system.svc.cluster.local)" ]; then
/src/code/tools/run_tests/performance/prometheus.py \
--url=http://prometheus.test-infra-system.svc.cluster.local:9090 \
--pod_type=clients --container_name=main \
--container_name=sidecar --delay_seconds=20 \
--export_file_name=prometheus_query_results.json
fi
fi

if [ -n "${BQ_RESULT_TABLE}" ]; then
if [ -r "${METADATA_OUTPUT_FILE}" ]; then
cp "${METADATA_OUTPUT_FILE}" metadata.json
fi
if [ -r "${NODE_INFO_OUTPUT_FILE}" ]; then
cp "${NODE_INFO_OUTPUT_FILE}" node_info.json
if [ -n "${SERVER_TARGET_OVERRIDE}" ] || [ -n "${ENABLE_PROMETHEUS}" ]; then
if [ "$(dig +short -t srv prometheus.test-infra-system.svc.cluster.local)" ]; then
python3 /src/code/tools/run_tests/performance/prometheus.py \
--url=http://prometheus.test-infra-system.svc.cluster.local:9090 \
--pod_type=clients --container_name=main \
--container_name=sidecar --delay_seconds=20
fi
fi
fi
python3 /src/code/tools/run_tests/performance/bq_upload_result.py --bq_result_table="${BQ_RESULT_TABLE}"
/src/code/tools/run_tests/performance/bq_upload_result.py --bq_result_table="${BQ_RESULT_TABLE}"
fi

0 comments on commit 3cc5171

Please sign in to comment.