public void BeginRequest(HttpContext httpContext, HostingApplication.Context context) { if (httpContext.Request.Headers.ContainsKey(CorrelationVectorPropagationDelegates.HeaderName)) { httpContext.SetCorrelationVector( CorrelationVector.Extend(httpContext.Request.Headers[CorrelationVectorPropagationDelegates.HeaderName][0])); } }
public static Task <HttpResponseMessage> SendAsync( this HttpClient httpClient, CorrelationVector correlationVector, HttpRequestMessage requestMessage) { requestMessage.Properties.Add( CorrelationVectorPropagationDelegates.HttpRequestMessagePropertyName, correlationVector); return(httpClient.SendAsync(requestMessage)); }
public static void FromHttpRequestMessageProperty(HttpRequestMessage requestMessage) { if (requestMessage.Properties.ContainsKey(HttpRequestMessagePropertyName)) { CorrelationVector correlationVector = requestMessage.Properties[HttpRequestMessagePropertyName] as CorrelationVector; if (correlationVector != null) { requestMessage.Headers.Add(HeaderName, correlationVector.Increment()); } } }
public override void ActivityStarted() { CorrelationVectorExtension parentExtension = Activity.Parent?.GetActivityExtension <CorrelationVectorExtension>(); if (!string.IsNullOrEmpty(_externalCorrelationVectorParent)) { this.CorrelationVector = CorrelationVector.Extend(_externalCorrelationVectorParent); } else if (parentExtension != null) { this.CorrelationVector = parentExtension.CorrelationVector; } else { this.CorrelationVector = new CorrelationVector(); } }
public static void SetCorrelationVector(this HttpContext httpContext, CorrelationVector correlationVector) { httpContext.Items.Add(typeof(CorrelationVector), correlationVector); }