code: def test_metrics_disablement(_setup_cluster_for_test):
      """Make sure the metrics are not exported when it is disabled."""
      (
          prom_addresses,
          autoscaler_export_addr,
          _,
      ) = _setup_cluster_for_test
  
      def verify_metrics_not_collected():
          components_dict, metric_names, _ = fetch_prometheus(
              prom_addresses
          )
          # Make sure no component is reported.
          for _, comp in components_dict.items():
              if len(comp) > 0:
                  print(
                      f"metrics from a component {comp} exists although it should not."
                  )
                  return False
  
          # Make sure metrics are not there.
          for metric in (
              _METRICS + _AUTOSCALER_METRICS + _DASHBOARD_METRICS
          ):
              if metric in metric_names:
                  print("f{metric} exists although it should not.")
                  return False
          return True
  
      # Make sure metrics are not collected for more than 10 seconds.
      for _ in range(10):
          assert verify_metrics_not_collected()
          import time
  
          time.sleep(1)
  
imports: import signal
  import json
  import os
  import pathlib
  import sys
  import requests
  from pprint import pformat
  from unittest.mock import MagicMock
  import numpy
  import pytest
  import ray
  from ray.util.state import list_nodes
  from ray._private.metrics_agent import PrometheusServiceDiscoveryWriter
  from ray._private.ray_constants import PROMETHEUS_SERVICE_DISCOVERY_FILE
  from ray._private.test_utils import SignalActor, fetch_prometheus, fetch_prometheus_metrics, get_log_batch, wait_for_condition, raw_metrics
  from ray.autoscaler._private.constants import AUTOSCALER_METRIC_PORT
  from ray.dashboard.consts import DASHBOARD_METRIC_PORT
  from ray.util.metrics import Counter, Gauge, Histogram
label_desc: Use image node_id 15 for calling a global function with example usage: test_metrics_disablement(_setup_cluster_for_test) and returns: True, False, False