diff --git a/src/DurableTask.Core/History/SubOrchestrationInstanceCreatedEvent.cs b/src/DurableTask.Core/History/SubOrchestrationInstanceCreatedEvent.cs index 646070933..1931d2d8d 100644 --- a/src/DurableTask.Core/History/SubOrchestrationInstanceCreatedEvent.cs +++ b/src/DurableTask.Core/History/SubOrchestrationInstanceCreatedEvent.cs @@ -13,6 +13,7 @@ namespace DurableTask.Core.History { + using System.Collections.Generic; using System.Runtime.Serialization; /// @@ -47,6 +48,7 @@ internal SubOrchestrationInstanceCreatedEvent(SubOrchestrationInstanceCreatedEve InstanceId = other.InstanceId; Input = other.Input; ClientSpanId = other.ClientSpanId; + Tags = other.Tags; } /// @@ -83,5 +85,11 @@ internal SubOrchestrationInstanceCreatedEvent(SubOrchestrationInstanceCreatedEve /// [DataMember] public string ClientSpanId { get; set; } + + /// + /// Gets or sets a dictionary of tags of string, string + /// + [DataMember] + public IDictionary Tags { get; set; } } } \ No newline at end of file diff --git a/src/DurableTask.Core/OrchestrationRuntimeState.cs b/src/DurableTask.Core/OrchestrationRuntimeState.cs index 3c10fe693..ab7d76044 100644 --- a/src/DurableTask.Core/OrchestrationRuntimeState.cs +++ b/src/DurableTask.Core/OrchestrationRuntimeState.cs @@ -389,6 +389,7 @@ HistoryEvent GenerateAbridgedEvent(HistoryEvent evt) Version = subOrchestrationInstanceCreatedEvent.Version, Input = "[..snipped..]", ClientSpanId = subOrchestrationInstanceCreatedEvent.ClientSpanId, + Tags = subOrchestrationInstanceCreatedEvent.Tags, }; } else if (evt is SubOrchestrationInstanceCompletedEvent subOrchestrationInstanceCompletedEvent) diff --git a/src/DurableTask.Core/TaskOrchestrationDispatcher.cs b/src/DurableTask.Core/TaskOrchestrationDispatcher.cs index b81cbae50..ad0d43230 100644 --- a/src/DurableTask.Core/TaskOrchestrationDispatcher.cs +++ b/src/DurableTask.Core/TaskOrchestrationDispatcher.cs @@ -1221,11 +1221,14 @@ TaskMessage ProcessCreateSubOrchestrationInstanceDecision( bool includeParameters, Activity? parentTraceActivity) { + IDictionary mergedTags = OrchestrationTags.MergeTags(createSubOrchestrationAction.Tags, runtimeState.Tags); + var historyEvent = new SubOrchestrationInstanceCreatedEvent(createSubOrchestrationAction.Id) { Name = createSubOrchestrationAction.Name, Version = createSubOrchestrationAction.Version, InstanceId = createSubOrchestrationAction.InstanceId, + Tags = mergedTags, }; if (includeParameters) { @@ -1238,7 +1241,6 @@ TaskMessage ProcessCreateSubOrchestrationInstanceDecision( var startedEvent = new ExecutionStartedEvent(-1, createSubOrchestrationAction.Input) { - Tags = OrchestrationTags.MergeTags(createSubOrchestrationAction.Tags, runtimeState.Tags), OrchestrationInstance = new OrchestrationInstance { InstanceId = createSubOrchestrationAction.InstanceId, @@ -1252,7 +1254,8 @@ TaskMessage ProcessCreateSubOrchestrationInstanceDecision( TaskScheduleId = createSubOrchestrationAction.Id }, Name = createSubOrchestrationAction.Name, - Version = createSubOrchestrationAction.Version + Version = createSubOrchestrationAction.Version, + Tags = mergedTags, }; // If a parent trace context was provided via the CreateSubOrchestrationAction.Tags, we will use this as the parent trace context of the suborchestration execution Activity rather than Activity.Current.Context.