Exemplo n.º 1
0
        /// <summary>
        /// Attach activity information to outgoing remoting request headers
        /// </summary>
        public static void AttachActivityToOutgoingRequest(this IServiceRemotingRequestMessage requestMessage, Activity?activity)
        {
            if (activity == null)
            {
                return;
            }

            IServiceRemotingRequestMessageHeader header = requestMessage.GetHeader();

            header.AddHeader(TraceParentHeaderName, s_encoding.GetBytes(activity.Id));
            header.AddHeader(TraceStateHeaderName, SerializeBaggage(activity.Baggage.ToArray()));
        }
        public static bool TryAddHeader(this IServiceRemotingRequestMessageHeader headers, string headerName, PropagationContext context, Func <PropagationContext, byte[]> headerValue)
        {
            if (!headers.TryGetHeaderValue(headerName, out _))
            {
                byte[] bytes = headerValue(context);
                headers.AddHeader(headerName, bytes);
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public static bool TryAddHeader(this IServiceRemotingRequestMessageHeader headers, string headerName, string headerValue)
        {
            if (!headers.TryGetHeaderValue(headerName, out _))
            {
                byte[] bytes = Encoding.UTF8.GetBytes(headerValue);
                headers.AddHeader(headerName, bytes);
                return(true);
            }

            return(false);
        }
 internal static void AddHeader(this IServiceRemotingRequestMessageHeader messageHeaders, string headerName, string value)
 {
     messageHeaders.AddHeader(headerName, Encoding.UTF8.GetBytes(value));
 }