Table of Contents

Class InboundTraceContext

Namespace
FlowOrchestrator.Core.Observability
Assembly
FlowOrchestrator.Core.dll

Helpers for extracting an ActivityContext from W3C trace-context headers on an inbound HTTP request.

public static class InboundTraceContext
Inheritance
InboundTraceContext
Inherited Members

Remarks

The Dashboard's webhook and signal endpoints call TryParse(string?, string?, out ActivityContext) with the values of the inbound traceparent / tracestate headers and, on success, start the entry-point activity as a child of the parent context. This stitches the run's spans onto the caller's distributed trace even when the consuming app has not enabled AddAspNetCoreInstrumentation(). The helper lives in Core so it is reusable from any runtime adapter that exposes its own ingress points.

Fields

TraceparentHeaderName

The standard W3C header name for the incoming trace identifier.

public const string TraceparentHeaderName = "traceparent"

Field Value

string

TracestateHeaderName

The standard W3C header name for vendor-specific trace state.

public const string TracestateHeaderName = "tracestate"

Field Value

string

Methods

StartActivity(ActivitySource, string, ActivityKind, string?, string?)

Starts an inbound activity, using the W3C headers as the parent context when present. Falls back to a normal root activity when the headers are absent or invalid.

public static Activity? StartActivity(ActivitySource source, string name, ActivityKind kind, string? traceparent, string? tracestate)

Parameters

source ActivitySource

The activity source to start the activity on.

name string

Activity name (e.g. "flow.webhook.receive", "flow.signal.deliver").

kind ActivityKind

Activity kind. Defaults to Server for HTTP ingress.

traceparent string

Inbound traceparent header value or null.

tracestate string

Inbound tracestate header value or null.

Returns

Activity

The started activity, or null when no listener is subscribed.

TryParse(string?, string?, out ActivityContext)

Attempts to parse an ActivityContext from the standard W3C headers.

public static bool TryParse(string? traceparent, string? tracestate, out ActivityContext context)

Parameters

traceparent string

Value of the traceparent header, or null.

tracestate string

Value of the tracestate header, or null.

context ActivityContext

Receives the parsed context on success.

Returns

bool

true when both traceparent is present and parses successfully.