code: def test_metrics_agent_proxy_record_and_export_from_workers(
      get_agent,
  ):
      """
      Test the basic worker death case.
      """
      namespace = "test"
      agent, agent_port = get_agent
      worker_id = WorkerID.from_random()
  
      m = generate_protobuf_metric(
          "test", "desc", "", label_keys=["a", "b"], timeseries=[]
      )
      m.timeseries.append(generate_timeseries(["a", "b"], [1, 2, 3]))
      agent.proxy_export_metrics([m], worker_id_hex=worker_id.hex())
      # Metrics should be exposed.
      assert get_metric(f"{namespace}_test", agent_port) is not None
      agent.clean_all_dead_worker_metrics()
      # Once the worker is dead, metrics should be unavailble.
      assert get_metric(f"{namespace}_test", agent_port) is None
      # Once the worker metrics is re-reported, it is treated as alive again.
      agent.proxy_export_metrics([m], worker_id_hex=worker_id.hex())
      assert get_metric(f"{namespace}_test", agent_port) is not None
      # Clean it again and the worker metrics is cleaned again.
      agent.clean_all_dead_worker_metrics()
      assert get_metric(f"{namespace}_test", agent_port) is None
  
imports: import os
  import time
  import sys
  import pytest
  import ray._private.prometheus_exporter
  from typing import List
  from opencensus.stats.view_manager import ViewManager
  from opencensus.stats.stats_recorder import StatsRecorder
  from opencensus.stats import execution_context
  from prometheus_client.core import REGISTRY
  from ray._private.metrics_agent import Gauge, MetricsAgent, Record, RAY_WORKER_TIMEOUT_S
  from ray._private.services import new_port
  from ray.core.generated.metrics_pb2 import Metric, MetricDescriptor, Point, LabelKey, TimeSeries, LabelValue
  from ray._raylet import WorkerID
  from ray._private.test_utils import fetch_prometheus_metrics, fetch_raw_prometheus, wait_for_condition
label_desc: Use image node_id 9 for calling a global function with example usage: test_metrics_agent_proxy_record_and_export_from_workers(get_agent) without return types