specifyStartupTiming method

  1. @protected
void specifyStartupTiming(
  1. StartupTimingType specifier, {
  2. Map<String, dynamic> tags = const {},
  3. List<Reference> references = const [],
})

Creates a span with globalTracer from the start of load until now.

The specifier indicates the purpose of this span.

Any tags or references specified will be added to this span.

Implementation

@protected
void specifyStartupTiming(
  StartupTimingType specifier, {
  Map<String, dynamic> tags = const {},
  List<Reference> references = const [],
}) {
  // Load didn't start
  if (_loadContext == null || _startLoadTime == null) {
    throw StateError(
        'Calling `specifyStartupTiming` before calling `load()`');
  }

  final tracer = globalTracer();
  if (tracer == null) {
    return null;
  }

  tracer
      .startSpan(
        '$name.${specifier.operationName}',
        references: [tracer.followsFrom(_loadContext!)]..addAll(references),
        startTime: _startLoadTime,
        tags: _defaultTags..addAll(tags),
      )
      ?.finish();

  _startLoadTime = null;
}