code: def __init__(
      self,
      name: tuple[str, ...],
      id_: str,
      parent: Span | None,
      total_nthreads_history: list[tuple[float, int]],
  ):
      self.name = name
      self.id = id_
      self._parent = weakref.ref(parent) if parent is not None else None
      self.enqueued = time()
      self.children = []
      self.groups = set()
      self._code = {}
  
      # Don't cast int metrics to float
      self._cumulative_worker_metrics = defaultdict(int)
  
      assert len(total_nthreads_history) > 0
      self._total_nthreads_history = total_nthreads_history
      self._total_nthreads_offset = len(total_nthreads_history) - 1
  
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 1 to create a new Span object  with example: obj = Span(name, id_, parent, total_nthreads_history)