HttpSpanRecorder.start constructor
HttpSpanRecorder.start({})
Starts a client span named after the (normalized) HTTP method.
Does not write screen.name. ScreenNameSpanProcessor stamps it at
span start when a route is known.
When context is provided it is used as the parent context (bypassing
the action window). Pass an explicit context to nest under an
image.load (or other) parent span.
Implementation
factory HttpSpanRecorder.start({
required String tracerName,
required String method,
required Uri url,
required Set<HttpTimingPhase> supportedPhases,
Context? context,
}) {
final tracer = globalTracerProvider.getTracer(
tracerName,
version: pluginVersion,
);
final normalized = _normalizeMethod(method);
final span =
context != null
? tracer.startSpan(
normalized.spanName,
kind: SpanKind.client,
context: context,
)
: tracer.startSpan(normalized.spanName, kind: SpanKind.client);
final recorder = HttpSpanRecorder._(
span: span,
url: url,
originalMethod: method,
supportedPhases: supportedPhases,
);
recorder._applyRequestAttrs(normalized);
return recorder;
}