Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace DurableTask.Core.History
{
using System.Collections.Generic;
using System.Runtime.Serialization;

/// <summary>
Expand Down Expand Up @@ -47,6 +48,7 @@ internal SubOrchestrationInstanceCreatedEvent(SubOrchestrationInstanceCreatedEve
InstanceId = other.InstanceId;
Input = other.Input;
ClientSpanId = other.ClientSpanId;
Tags = other.Tags;
}

/// <summary>
Expand Down Expand Up @@ -83,5 +85,11 @@ internal SubOrchestrationInstanceCreatedEvent(SubOrchestrationInstanceCreatedEve
/// </summary>
[DataMember]
public string ClientSpanId { get; set; }

/// <summary>
/// Gets or sets a dictionary of tags of string, string
/// </summary>
[DataMember]
public IDictionary<string, string> Tags { get; set; }
}
}
1 change: 1 addition & 0 deletions src/DurableTask.Core/OrchestrationRuntimeState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions src/DurableTask.Core/TaskOrchestrationDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,11 +1221,14 @@ TaskMessage ProcessCreateSubOrchestrationInstanceDecision(
bool includeParameters,
Activity? parentTraceActivity)
{
IDictionary<string, string> 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)
{
Expand All @@ -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,
Expand All @@ -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.
Expand Down
Loading