code: def test_status_task_events_metrics(shutdown_only):
      info = ray.init(num_cpus=1, _system_config=_SYSTEM_CONFIG)
  
      # Start a task
      @ray.remote
      def f():
          pass
  
      for _ in range(10):
          ray.get(f.remote())
  
      def verify():
          metric = aggregate_task_event_metric(info)
          assert metric["REPORTED"] >= 10, (
              "At least 10 tasks events should be reported. "
              "Could be more than 10 with multiple flush."
          )
          assert (
              metric["STORED"] == 11
          ), "10 task + 1 driver's events should be stored."
  
          return True
  
      wait_for_condition(
          verify,
          timeout=20,
          retry_interval_ms=100,
      )
  
imports: from collections import defaultdict
  from typing import Dict
  import os
  import pytest
  import sys
  import threading
  import time
  from ray._private.state_api_test_utils import verify_failed_task
  from ray.exceptions import RuntimeEnvSetupError
  from ray.runtime_env import RuntimeEnv
  import ray
  from ray.util.state.common import ListApiOptions, StateResource
  from ray._private.test_utils import raw_metrics, run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition
  from ray.util.state import StateApiClient, list_tasks
  from ray._private.worker import RayContext
label_desc: Use image node_id 2 for calling a global function with example usage: test_status_task_events_metrics(shutdown_only) and returns: True