Add query delay flag to Prometheus query script. (#31611)

* Add query delay flag to Prometheus query script.

This PR adds the flag allows user to config the delay of querying
the Prometheus.

* Update the help message of the flag to be more clear.
pull/31708/head
Wanlin Du 2 years ago committed by GitHub
parent c6a1d0692f
commit 4b40f957a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      tools/run_tests/performance/prometheus.py

@ -31,6 +31,7 @@ import argparse
import json
import logging
import statistics
import time
from typing import Any, Dict, List
from dateutil import parser
@ -269,6 +270,13 @@ def main() -> None:
default=False,
help='Suppress informative output',
)
argp.add_argument(
'--delay_seconds',
default=0,
type=int,
help=
'Configure delay in seconds to perform Prometheus queries, default is 0',
)
args = argp.parse_args()
if not args.quiet:
@ -285,6 +293,8 @@ def main() -> None:
end=end_time,
)
time.sleep(args.delay_seconds)
pod_dict = construct_pod_dict(args.node_info_file, args.pod_type)
processed_data = p.fetch_cpu_and_memory_data(
container_list=args.container_name, pod_dict=pod_dict)

Loading…
Cancel
Save