class_docstr: Scheduler extension for spans support
class_docstr_tok: ["Scheduler","extension","for","spans","support"]
docstr: Triggered by :meth:`SpansWorkerExtension.heartbeat`.
  
  Populate :meth:`Span.cumulative_worker_metrics` with data from the worker.
  
  See Also
  --------
  SpansWorkerExtension.heartbeat
  Span.cumulative_worker_metrics
docstr_tok: ["Triggered","by",":","meth",":","`","SpansWorkerExtension.heartbeat","`",".","Populate",":","meth",":","`","Span.cumulative_worker_metrics","`","with","data","from","the","worker",".","See","Also","--","--","--","--","SpansWorkerExtension.heartbeat","Span.cumulative_worker_metrics"]
code: def heartbeat(
      self,
      ws: scheduler_module.WorkerState,
      data: dict[tuple[Hashable, ...], float],
  ) -> None:
      """Triggered by :meth:`SpansWorkerExtension.heartbeat`.
  
      Populate :meth:`Span.cumulative_worker_metrics` with data from the worker.
  
      See Also
      --------
      SpansWorkerExtension.heartbeat
      Span.cumulative_worker_metrics
      """
      for (context, span_id, *other), v in data.items():
          assert isinstance(span_id, str)
          span = self.spans[span_id]
          span._cumulative_worker_metrics[(context, *other)] += v
  
imports: from __future__ import annotations
  import uuid
  import weakref
  from collections import defaultdict
  from collections.abc import Hashable, Iterable, Iterator
  from contextlib import contextmanager
  from itertools import islice
  from typing import TYPE_CHECKING, Any
  import dask.config
  from dask.typing import Key
  from distributed.collections import sum_mappings
  from distributed.itertools import ffill
  from distributed.metrics import time
label_desc: Use image node_id 8 for calling the SpansSchedulerExtension obj's underlying member method code with example usage: obj.heartbeat(ws, data) without return types