code: def __init__(
      self,
      dashboard_head,
      http_session: Optional[aiohttp.ClientSession] = None,
  ):
      super().__init__(dashboard_head)
      self.http_session = http_session or aiohttp.ClientSession()
      self.grafana_host = os.environ.get(
          GRAFANA_HOST_ENV_VAR, DEFAULT_GRAFANA_HOST
      )
      self.prometheus_host = os.environ.get(
          PROMETHEUS_HOST_ENV_VAR, DEFAULT_PROMETHEUS_HOST
      )
      default_metrics_root = os.path.join(
          self._dashboard_head.session_dir, "metrics"
      )
      self._metrics_root = os.environ.get(
          METRICS_OUTPUT_ROOT_ENV_VAR, default_metrics_root
      )
      grafana_config_output_path = os.path.join(
          self._metrics_root, "grafana"
      )
      self._grafana_dashboard_output_dir = os.environ.get(
          GRAFANA_DASHBOARD_OUTPUT_DIR_ENV_VAR,
          os.path.join(grafana_config_output_path, "dashboards"),
      )
  
      self._prometheus_name = os.environ.get(
          PROMETHEUS_NAME_ENV_VAR, DEFAULT_PROMETHEUS_NAME
      )
  
      # To be set later when dashboards gets generated
      self._dashboard_uids = {}
  
      self._session = aiohttp.ClientSession()
      self._ip = dashboard_head.ip
      self._pid = os.getpid()
      self._component = "dashboard"
      self._session_name = dashboard_head.session_name
      assert self._component in AVAILABLE_COMPONENT_NAMES_FOR_METRICS
  
imports: import asyncio
  import aiohttp
  import logging
  import os
  import shutil
  from typing import Optional
  import psutil
  from urllib.parse import quote
  from ray.dashboard.modules.metrics.grafana_dashboard_factory import generate_default_grafana_dashboard, generate_serve_grafana_dashboard, generate_serve_deployment_grafana_dashboard, generate_data_grafana_dashboard
  from ray.dashboard.modules.metrics.grafana_datasource_template import GRAFANA_DATASOURCE_TEMPLATE
  from ray.dashboard.modules.metrics.grafana_dashboard_provisioning_template import DASHBOARD_PROVISIONING_TEMPLATE
  import ray.dashboard.optional_utils
  import ray.dashboard.utils
  from ray.dashboard.consts import AVAILABLE_COMPONENT_NAMES_FOR_METRICS
label_desc: Use image node_id 1 to create a new MetricsHead object from inherited base classes: dashboard_utils with example: obj = MetricsHead(dashboard_head, http_session)