code: def test_metric_debouncing(relay_server, wandb_init):
      with relay_server() as relay:
          run = wandb_init()
          run.define_metric("*", summary="min,max")
  
          # test many defined metrics logged at once
          log_arg = {str(i): i for i in range(100)}
          run.log(log_arg)
  
          # and serially
          for i in range(100, 200):
              run.log({str(i): i})
  
          run.finish()
  
      # without debouncing, the number of config updates should be ~200, one for each defined metric.
      # with debouncing, the number should be << 12 (the minimum number of debounce loops to exceed the
      # 60s test timeout at a 5s debounce interval)
      # assert relay["upsert_bucket_count"] <= 12
      assert (
          1
          <= sum(
              "UpsertBucket" in entry["request"].get("query", "")
              for entry in relay.context.raw_data
          )
          <= 12
      )
  
imports: import pytest
label_desc: Use image node_id 25 for calling a global function with example usage: test_metric_debouncing(relay_server, wandb_init) without return types