code: def test_context_meter_keyed():
      cbs = []
  
      def cb(tag, key):
          return metrics.context_meter.add_callback(
              lambda l, v, u: cbs.append((tag, l)), key=key
          )
  
      with cb("x", key="x"), cb("y", key="y"):
          metrics.context_meter.digest_metric("l1", 1, "u")
          with cb("z", key="x"):
              metrics.context_meter.digest_metric("l2", 2, "u")
          metrics.context_meter.digest_metric("l3", 3, "u")
  
      assert cbs == [
          ("x", "l1"),
          ("y", "l1"),
          ("z", "l2"),
          ("y", "l2"),
          ("x", "l3"),
          ("y", "l3"),
      ]
  
imports: from __future__ import annotations
  import math
  import pickle
  import threading
  import time
  import pytest
  from distributed import metrics
  from distributed.compatibility import WINDOWS
  from distributed.utils import offload
  from distributed.utils_test import gen_test
label_desc: Use image node_id 15 for calling a global function with example usage: test_context_meter_keyed() and returns: metrics