code: def generate_metric_table(server_addr, server_port):  # noqa:C901
      model_table = {}
      gpu_table = {}
      try:
          res = requests.get(
              "http://{}:{}/metrics".format(server_addr, server_port)
          )
      except Exception:
          return None
      metric_content = res.text
      for content in metric_content.split("\n"):
          if content.startswith("#"):
              continue
          else:
              res = re.match(
                  r"(\w+){(.*)} (\w+)", content
              )  # match output by server metrics interface
              if not res:
                  continue
              metric_name = res.group(1)
              model = res.group(2)
              value = res.group(3)
              infos = {}
              for info in model.split(","):
                  k, v = info.split("=")
                  v = v.strip('"')
                  infos[k] = v
              if metric_name in [
                  "nv_inference_request_duration_us",
                  "nv_inference_queue_duration_us",
                  "nv_inference_compute_input_duration_us",
                  "nv_inference_compute_infer_duration_us",
                  "nv_inference_compute_output_duration_us",
              ]:
                  value = float(value) / 1000
              elif metric_name in [
                  "nv_gpu_memory_total_bytes",
                  "nv_gpu_memory_used_bytes",
              ]:
                  value = float(value) / 1024 / 1024 / 1024
              for key, metric_names in _metric_column_name.items():
                  if metric_name in metric_names:
                      if key == "Model":
                          model_name = infos["model"]
                          if model_name not in model_table:
                              model_table[model_name] = {}
                          model_table[model_name][metric_name] = value
                      elif key == "GPU":
                          gpu_name = infos["gpu_uuid"]
                          if gpu_name not in gpu_table:
                              gpu_table[gpu_name] = {}
                          gpu_table[gpu_name][metric_name] = value
                      elif key == "CPU":
                          pass
      results = {}
      results["Model"] = model_table
      results["GPU"] = gpu_table
      return results
  
imports: import copy
  import json
  import os
  import random
  import re
  import signal
  import string
  from collections import defaultdict
  from subprocess import Popen
  from subprocess import STDOUT
  import google.protobuf.json_format
  import google.protobuf.text_format
  import psutil
  import requests
  from .proto.model_config_pb2 import ModelConfig
  from visualdl.utils.dir import FASTDEPLOYSERVER_PATH
label_desc: Use image node_id 25 for calling a global function with example usage: generate_metric_table(server_addr, server_port) and returns: results, None