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)
| 659 | |
| 660 | |
| 661 | async 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 | |
| 689 | def main(args: argparse.Namespace): |