code: def get_metric_data(server_addr, metric_port, lang="zh"):  # noqa:C901
      """
      Get metrics data from fastdeploy server, and transform it into html table.
      Args:
          server_addr(str): fastdeployserver ip address
          metric_port(int): fastdeployserver metrics port
      Returns:
          htmltable(str): html table to show metrics data
      """
      model_table = {}
      gpu_table = {}
      metric_column_name = {
          "Model": {
              "nv_inference_request_success",
              "nv_inference_request_failure",
              "nv_inference_count",
              "nv_inference_exec_count",
              "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",
          },
          "GPU": {
              "nv_gpu_power_usage",
              "nv_gpu_power_limit",
              "nv_energy_consumption",
              "nv_gpu_utilization",
              "nv_gpu_memory_total_bytes",
              "nv_gpu_memory_used_bytes",
          },
          "CPU": {
              "nv_cpu_utilization",
              "nv_cpu_memory_total_bytes",
              "nv_cpu_memory_used_bytes",
          },
      }
      try:
          res = requests.get(
              "http://{}:{}/metrics".format(server_addr, metric_port)
          )
      except Exception:
          return metrics_table_head.format("", "")
      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 = str(float(value) / 1000)
              elif metric_name in [
                  "nv_gpu_memory_total_bytes",
                  "nv_gpu_memory_used_bytes",
              ]:
                  value = str(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
      model_data_list = []
      gpu_data_list = []
      model_data_metric_names = [
          "nv_inference_request_success",
          "nv_inference_request_failure",
          "nv_inference_exec_count",
          "nv_inference_count",
          "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",
      ]
      gpu_data_metric_names = [
          "nv_gpu_utilization",
          "nv_gpu_power_usage",
          "nv_gpu_power_limit",
          "nv_energy_consumption",
          "nv_gpu_memory_total_bytes",
          "nv_gpu_memory_used_bytes",
      ]
      for k, v in model_table.items():
          data = []
          data.append(k)
          for data_metric in model_data_metric_names:
              data.append(v[data_metric])
          model_data_list.append(data)
      for k, v in gpu_table.items():
          data = []
          data.append(k)
          for data_metric in gpu_data_metric_names:
              data.append(v[data_metric])
          gpu_data_list.append(data)
      model_data = "\n".join(
          [
              "<tr>"
              + "\n".join(["<td>" + item + "</td>" for item in data])
              + "</tr>"
              for data in model_data_list
          ]
      )
      gpu_data = "\n".join(
          [
              "<tr>"
              + "\n".join(["<td>" + item + "</td>" for item in data])
              + "</tr>"
              for data in gpu_data_list
          ]
      )
      if lang == "en":
          return metrics_table_head_en.format(model_data, gpu_data)
      return metrics_table_head.format(model_data, gpu_data)
  
file_path: VisualDL/visualdl/component/inference/fastdeploy_client/http_client_manager.py
imports: import json
  import re
  import numpy
  import requests
  import tritonclient.http
label_desc: Use image node_id 2 for calling a global function with example usage: get_metric_data(server_addr, metric_port, lang) and returns: metrics_table_head, metrics_table_head_en, metrics_table_head