beginSpan method

  1. @override
Future<ResourceScopeSpan> beginSpan()
override

BeginSpan creates a new span scope rooted at this scope.

Implementation

@override
Future<ResourceScopeSpan> beginSpan() async {
  if (_isDone) {
    throw _wrapError(network_errors.ResourceScopeClosedException());
  }
  _refCnt++; // Owner's ref count increases because a span is now active
  _spanIdCounter++;
  final spanName = '$name.span-$_spanIdCounter';
  // Span inherits its limit from the owner.
  return ResourceScopeImpl._asSpan(_resources.limit, spanName, this, _spanIdCounter);
}