Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        private void DisposeBuilder()
        {
            if (!disposed.TrySetTrue())
            {
                return;
            }

            if (read.HasValue)
            {
                builder.SetAnnotation(WellKnownAnnotations.Http.Response.Size, read.Value);
                additionalBuilder?.SetAnnotation(WellKnownAnnotations.Http.Response.Size, read.Value);
            }

            builder.Dispose();
            additionalBuilder?.Dispose();
        }