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
eventNamestringThe name of the event to add.
contextIMessageContextThe message context providing event data.
attributesIReadOnlyDictionary<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
operationNamestringThe name of the operation represented by the span.
contextIMessageContextThe message context associated with the span.
kindActivityKindThe 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
activityActivityThe activity to enrich.
contextIMessageContextThe message context providing enrichment data.
ExtractContextFromBaggage(IDictionary<string, string>, IMessageContext)
Extracts context from baggage.
void ExtractContextFromBaggage(IDictionary<string, string> carrier, IMessageContext context)
Parameters
carrierIDictionary<string, string>The carrier containing propagated values.
contextIMessageContextThe message context to populate.
LinkRelatedTrace(Activity?, string, string)
Links related traces using correlation IDs.
void LinkRelatedTrace(Activity? activity, string correlationId, string linkType = "correlation")
Parameters
activityActivityThe activity to link.
correlationIdstringThe correlation identifier to link with.
linkTypestringThe type of link being recorded.
PropagateContextAsBaggage(IMessageContext, IDictionary<string, string>)
Propagates context as baggage.
void PropagateContextAsBaggage(IMessageContext context, IDictionary<string, string> carrier)
Parameters
contextIMessageContextThe message context to propagate.
carrierIDictionary<string, string>The carrier receiving the propagated values.