code: def aggregate_task_event_metric(info: RayContext) -> Dict:
      """
      Aggregate metrics of task events into:
          {
              "REPORTED": ray_gcs_task_manager_task_events_reported,
              "STORED": ray_gcs_task_manager_task_events_stored,
              "DROPPED_PROFILE_EVENT":
                  ray_gcs_task_manager_task_events_dropped PROFILE_EVENT,
              "DROPPED_STATUS_EVENT":
                  ray_gcs_task_manager_task_events_dropped STATUS_EVENT,
          }
      """
      res = raw_metrics(info)
      task_events_info = defaultdict(int)
      if "ray_gcs_task_manager_task_events_dropped" in res:
          for sample in res["ray_gcs_task_manager_task_events_dropped"]:
              if (
                  "Type" in sample.labels
                  and sample.labels["Type"] != ""
              ):
                  task_events_info[
                      "DROPPED_" + sample.labels["Type"]
                  ] += sample.value
  
      if "ray_gcs_task_manager_task_events_stored" in res:
          for sample in res["ray_gcs_task_manager_task_events_stored"]:
              task_events_info["STORED"] += sample.value
  
      if "ray_gcs_task_manager_task_events_reported" in res:
          for sample in res[
              "ray_gcs_task_manager_task_events_reported"
          ]:
              task_events_info["REPORTED"] += sample.value
  
      return task_events_info
  
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 1 for calling a global function with example usage: aggregate_task_event_metric(info) and returns: task_events_info