TraceContextHelper.ExtractContextFromHeaders Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Extracts an ActivityContext from W3C trace HTTP headers.
public static System.Diagnostics.ActivityContext ExtractContextFromHeaders(System.Collections.Generic.IDictionary<string,string> headers);
static member ExtractContextFromHeaders : System.Collections.Generic.IDictionary<string, string> -> System.Diagnostics.ActivityContext
Public Shared Function ExtractContextFromHeaders (headers As IDictionary(Of String, String)) As ActivityContext
Parameters
- headers
- IDictionary<String,String>
Dictionary of HTTP headers containing trace context.
Expected keys include traceparent and optionally tracestate.
Returns
An ActivityContext containing the extracted trace information.
Returns default if no valid trace context is found.
Remarks
Parses the traceparent (and optionally tracestate) headers and returns an ActivityContext that can be passed as parentContext to any scope's Start() method.