fromCompletedRequest static method
Construct a new EmbraceNetworkRequest instance where a HTTP response was returned. If no response was returned, use fromIncompleteRequest instead.
url
: the URL of the request.httpMethod
: the HTTP method of the request.startTime
: the start time of the request.endTime
: the end time of the request.bytesSent
: the number of bytes sent.bytesReceived
: the number of bytes received.statusCode
: the status code of the response.traceId
: the trace ID of the request, used for distributed tracing.w3cTraceparent
: a w3c trace parent of the request, used to enable network span forwarding Returns a new EmbraceNetworkRequest instance.
Implementation
// ignore: prefer_constructors_over_static_methods
static EmbraceNetworkRequest fromCompletedRequest({
required String url,
required HttpMethod httpMethod,
required int startTime,
required int endTime,
required int bytesSent,
required int bytesReceived,
required int statusCode,
String? traceId,
String? w3cTraceparent,
}) {
return EmbraceNetworkRequest._(
url: url,
httpMethod: httpMethod,
startTime: startTime,
endTime: endTime,
bytesSent: bytesSent,
bytesReceived: bytesReceived,
statusCode: statusCode,
errorDetails: null,
traceId: traceId,
w3cTraceparent: w3cTraceparent,
);
}