示例#1
0
 public static void SetRequestDetails(this IHttpRequestSpanBuilder builder, Request request)
 {
     builder.SetRequestDetails(
         request.Url,
         request.Method,
         request.Content?.Length ??
         request.CompositeContent?.Length ??
         request.StreamContent?.Length);
 }
示例#2
0
        public static Response SetResponseDetails(this IHttpRequestSpanBuilder builder, Response response)
        {
            if (response.HasStream)
            {
                builder.SetAnnotation(Constants.StreamingAnnotation, true);
                builder.SetAnnotation(WellKnownAnnotations.Http.Response.Code, (int)response.Code);

                if (response.Stream is ProxyStream proxyStream)
                {
                    proxyStream.AddAdditionalBuilder(builder);
                    return(response);
                }

                return(response.WithStream(new ProxyStream(response.Stream, builder)));
            }

            builder.SetResponseDetails((int)response.Code, GetContentLength(response));
            builder.Dispose();

            return(response);
        }
示例#3
0
 public void TestSetup()
 {
     builder  = Substitute.For <IHttpRequestSpanBuilder>();
     request  = Request.Get("foo/bar");
     response = Responses.Ok;
 }
 public void AddAdditionalBuilder(IHttpRequestSpanBuilder value) =>
 additionalBuilder = value;
 public ProxyStream(Stream stream, IHttpRequestSpanBuilder builder)
 {
     this.stream  = stream;
     this.builder = builder;
 }