ImageSpanRecorder.start constructor
Starts an image.load span for url.
modelType is the provider runtime type (e.g. VuNetworkImage).
Implementation
factory ImageSpanRecorder.start({
required String url,
String? modelType,
String? screenName,
}) {
final tracer = globalTracerProvider.getTracer(
ImageConstants.tracerImage,
version: pluginVersion,
);
final span = tracer.startSpan(
ImageConstants.spanImageLoad,
kind: SpanKind.client,
);
span.setAttribute(
Attribute.fromString(ImageConstants.attrUrl, sanitizeImageUrl(url)),
);
if (modelType != null && modelType.isNotEmpty) {
span.setAttribute(
Attribute.fromString(ImageConstants.attrModelType, modelType),
);
}
final screen = screenName ?? RouteObserverService().currentScreenName;
if (screen != null && screen.isNotEmpty) {
span.setAttribute(Attribute.fromString('screen.name', screen));
}
return ImageSpanRecorder._(span);
}