MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / fetch_perf_metrics

Function fetch_perf_metrics

tensorrt_llm/serve/scripts/benchmark_serving.py:661–686  ·  view source on GitHub ↗

Fetch performance metrics from the /perf_metrics endpoint. Args: base_url: The base URL of the server Returns: Dictionary containing the performance metrics

(base_url: str)

Source from the content-addressed store, hash-verified

659
660
661async def fetch_perf_metrics(base_url: str) -> dict:
662 """
663 Fetch performance metrics from the /perf_metrics endpoint.
664
665 Args:
666 base_url: The base URL of the server
667
668 Returns:
669 Dictionary containing the performance metrics
670 """
671 perf_url = f"{base_url}/perf_metrics"
672
673 async with aiohttp.ClientSession(trust_env=True,
674 timeout=AIOHTTP_TIMEOUT) as session:
675 try:
676 async with session.get(perf_url) as response:
677 if response.status == 200:
678 return await response.json()
679 else:
680 print(
681 f"Failed to fetch performance metrics. Status: {response.status}"
682 )
683 return {}
684 except Exception as e:
685 print(f"Error fetching performance metrics: {e}")
686 return {}
687
688
689def main(args: argparse.Namespace):

Callers 1

mainFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected