Table of Contents

Interface IContextTraceEnricher

Namespace
Excalibur.Dispatch.Observability.Context
Assembly
Excalibur.Dispatch.Observability.dll

Interface for context trace enrichment operations.

public interface IContextTraceEnricher
Extension Methods

Methods

AddContextEvent(string, IMessageContext, IReadOnlyDictionary<string, object>?)

Adds a context event to the current span.

void AddContextEvent(string eventName, IMessageContext context, IReadOnlyDictionary<string, object>? attributes = null)

Parameters

eventName string

The name of the event to add.

context IMessageContext

The message context providing event data.

attributes IReadOnlyDictionary<string, object>

Optional attributes to attach to the event.

CreateContextOperationSpan(string, IMessageContext, ActivityKind)

Creates a span for a context operation.

[RequiresUnreferencedCode("Context values are serialized with the reflection-based JSON serializer; supply source-generated serialization for trimming and AOT.")]
[RequiresDynamicCode("Context values are serialized with the reflection-based JSON serializer; supply source-generated serialization for trimming and AOT.")]
Activity? CreateContextOperationSpan(string operationName, IMessageContext context, ActivityKind kind = ActivityKind.Internal)

Parameters

operationName string

The name of the operation represented by the span.

context IMessageContext

The message context associated with the span.

kind ActivityKind

The span kind to create.

Returns

Activity

The created activity, if any.

EnrichActivity(Activity?, IMessageContext)

Enriches an activity with context information.

[RequiresUnreferencedCode("Context values are serialized with the reflection-based JSON serializer; supply source-generated serialization for trimming and AOT.")]
[RequiresDynamicCode("Context values are serialized with the reflection-based JSON serializer; supply source-generated serialization for trimming and AOT.")]
void EnrichActivity(Activity? activity, IMessageContext context)

Parameters

activity Activity

The activity to enrich.

context IMessageContext

The message context providing enrichment data.

ExtractContextFromBaggage(IDictionary<string, string>, IMessageContext)

Extracts context from baggage.

void ExtractContextFromBaggage(IDictionary<string, string> carrier, IMessageContext context)

Parameters

carrier IDictionary<string, string>

The carrier containing propagated values.

context IMessageContext

The message context to populate.

LinkRelatedTrace(Activity?, string, string)

Links related traces using correlation IDs.

void LinkRelatedTrace(Activity? activity, string correlationId, string linkType = "correlation")

Parameters

activity Activity

The activity to link.

correlationId string

The correlation identifier to link with.

linkType string

The type of link being recorded.

PropagateContextAsBaggage(IMessageContext, IDictionary<string, string>)

Propagates context as baggage.

void PropagateContextAsBaggage(IMessageContext context, IDictionary<string, string> carrier)

Parameters

context IMessageContext

The message context to propagate.

carrier IDictionary<string, string>

The carrier receiving the propagated values.