Span constructor

Span(
  1. String name,
  2. SpanContext _spanContext,
  3. SpanId? _parentSpanId,
  4. List<SpanProcessor> _processors,
  5. TimeProvider _timeProvider,
  6. Resource _resource,
  7. InstrumentationLibrary _instrumentationLibrary, {
  8. SpanKind? kind,
  9. List<Attribute>? attributes,
  10. List<SpanLink>? links,
  11. Context? parentContext,
  12. SpanLimits? limits,
  13. Int64? startTime,
})

Construct a Span.

Implementation

Span(this.name, this._spanContext, this._parentSpanId, this._processors,
    this._timeProvider, this._resource, this._instrumentationLibrary,
    {api.SpanKind? kind,
    List<api.Attribute>? attributes,
    List<api.SpanLink>? links,
    api.Context? parentContext,
    sdk.SpanLimits? limits,
    Int64? startTime})
    : _links = _applyLinkLimits(links ?? [], limits ?? sdk.SpanLimits()),
      _kind = kind ?? api.SpanKind.internal,
      _startTime = startTime ?? _timeProvider.now,
      _limits = limits ?? sdk.SpanLimits() {
  final pContext = parentContext ?? Context.current;

  if (attributes != null) {
    setAttributes(attributes);
  }

  for (var i = 0; i < _processors.length; i++) {
    _processors[i].onStart(this, pContext);
  }
}