code: def _objects_by_tag(info: RayContext, tag: str) -> Dict:
      res = raw_metrics(info)
      objects_info = defaultdict(int)
      if "ray_object_store_memory" in res:
          for sample in res["ray_object_store_memory"]:
              # NOTE: SPILLED sample doesn't report sealing states. So need to
              # filter those empty label value out.
              print(sample)
              if tag in sample.labels and sample.labels[tag] != "":
                  objects_info[sample.labels[tag]] += sample.value
  
      print(f"Objects by {tag}: {objects_info}")
      return objects_info
  
file_path: ray/python/ray/tests/test_object_store_metrics.py
imports: from collections import defaultdict
  import pytest
  from typing import Dict
  import numpy
  import sys
  import requests
  import ray
  from ray._private.test_utils import raw_metrics, wait_for_condition
  from ray._private.worker import RayContext
label_desc: Use image node_id 1 for calling a global function with example usage: _objects_by_tag(info, tag) and returns: objects_info