Skip to content

Commit d3dfd21

Browse files
authored
Merge branch 'main' into wangbill/atag
2 parents bb9ab1c + 7ea9c0d commit d3dfd21

File tree

15 files changed

+162
-32
lines changed

15 files changed

+162
-32
lines changed

Directory.Packages.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
<!-- Microsoft.Extensions.* Packages -->
1111
<ItemGroup>
1212
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
13-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
13+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="6.0.2" />
1414
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
15-
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.0" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net48'" />
15+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.1" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net48'" />
1616
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" Condition="'$(TargetFramework)' == 'net8.0'"/>
17-
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
17+
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.1" />
1818
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
19-
<PackageVersion Include="Microsoft.Extensions.Options" Version="6.0.0" />
19+
<PackageVersion Include="Microsoft.Extensions.Options" Version="6.0.1" />
2020
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="6.0.1" />
2121
</ItemGroup>
2222

@@ -28,7 +28,7 @@
2828

2929
<!-- DurableTask Packages -->
3030
<ItemGroup>
31-
<PackageVersion Include="Microsoft.Azure.DurableTask.Core" Version="3.1.1" />
31+
<PackageVersion Include="Microsoft.Azure.DurableTask.Core" Version="3.2.0" />
3232
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.2.2" />
3333
</ItemGroup>
3434

eng/ci/code-mirror.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ trigger:
44
# These are the branches we'll mirror to our internal ADO instance
55
# Keep this set limited as appropriate (don't mirror individual user branches).
66
- main
7+
- vabachu/release-testing
8+
- stevosyan/distributed-tracing-for-entities-isolated-with-dtcore-nuget
79

810
resources:
911
repositories:
@@ -16,4 +18,4 @@ variables:
1618
- template: ci/variables/cfs.yml@eng
1719

1820
extends:
19-
template: ci/code-mirror.yml@eng
21+
template: ci/code-mirror.yml@eng

eng/ci/official-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ trigger:
1212
branches:
1313
include:
1414
- main
15+
- vabachu/release-testing
16+
- stevosyan/distributed-tracing-for-entities-isolated-with-dtcore-nuget
1517

1618
# CI only, does not trigger on PRs.
1719
pr: none
@@ -50,4 +52,4 @@ extends:
5052
- stage: BuildAndSign
5153
dependsOn: []
5254
jobs:
53-
- template: /eng/templates/build.yml@self
55+
- template: /eng/templates/build.yml@self

eng/targets/Release.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</PropertyGroup>
1818

1919
<PropertyGroup>
20-
<VersionPrefix>1.10.0</VersionPrefix>
20+
<VersionPrefix>1.11.0</VersionPrefix>
2121
<VersionSuffix></VersionSuffix>
2222
</PropertyGroup>
2323

src/Abstractions/TaskOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public SubOrchestrationOptions(TaskOptions options, string? instanceId = null)
110110
/// <summary>
111111
/// Gets the version to associate with the sub-orchestration instance.
112112
/// </summary>
113-
public TaskVersion Version { get; init; } = default!;
113+
public TaskVersion? Version { get; init; }
114114
}
115115

116116
/// <summary>

src/Client/Grpc/GrpcDurableEntityClient.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System.Diagnostics;
45
using Microsoft.DurableTask.Client.Entities;
56
using Microsoft.DurableTask.Entities;
67
using Microsoft.Extensions.Logging;
@@ -54,8 +55,16 @@ public override async Task SignalEntityAsync(
5455
RequestId = requestId.ToString(),
5556
Name = operationName,
5657
Input = this.dataConverter.Serialize(input),
57-
ScheduledTime = scheduledTime?.ToTimestamp(),
58-
};
58+
ScheduledTime = scheduledTime?.ToTimestamp(),
59+
RequestTime = DateTimeOffset.UtcNow.ToTimestamp(),
60+
};
61+
62+
if (Activity.Current is { } activity)
63+
{
64+
request.ParentTraceContext ??= new P.TraceContext();
65+
request.ParentTraceContext.TraceParent = activity.Id;
66+
request.ParentTraceContext.TraceState = activity.TraceStateString;
67+
}
5968

6069
// TODO this.logger.LogSomething
6170
try

src/Client/Grpc/GrpcDurableTaskClient.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation.
1+
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

44
using System.Diagnostics;
@@ -79,7 +79,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
7979
Check.NotEntity(this.options.EnableEntitySupport, options?.InstanceId);
8080

8181
// We're explicitly OK with an empty version from the options as that had to be explicitly set. It should take precedence over the default.
82-
string version = string.Empty;
82+
string? version = null;
8383
if (options?.Version is { } v)
8484
{
8585
version = v;
@@ -95,6 +95,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
9595
Version = version,
9696
InstanceId = options?.InstanceId ?? Guid.NewGuid().ToString("N"),
9797
Input = this.DataConverter.Serialize(input),
98+
RequestTime = DateTimeOffset.UtcNow.ToTimestamp(),
9899
};
99100

100101
// Add tags to the collection

src/Client/OrchestrationServiceClientShim/ShimDurableEntityClient.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System.Diagnostics;
45
using DurableTask.Core;
5-
using DurableTask.Core.Entities;
6+
using DurableTask.Core.Entities;
7+
using DurableTask.Core.Tracing;
68
using Microsoft.DurableTask.Client.Entities;
79
using Microsoft.DurableTask.Entities;
810

@@ -90,7 +92,10 @@ public override async Task SignalEntityAsync(
9092
EntityMessageEvent.GetCappedScheduledTime(
9193
DateTime.UtcNow,
9294
this.options.Entities.MaxSignalDelayTimeOrDefault,
93-
scheduledTime?.UtcDateTime));
95+
scheduledTime?.UtcDateTime),
96+
Activity.Current is { } activity ? new DistributedTraceContext(activity.Id!, activity.TraceStateString) : null,
97+
requestTime: DateTimeOffset.UtcNow,
98+
createTrace: true);
9499

95100
await this.options.Client!.SendTaskOrchestrationMessageAsync(eventToSend.AsTaskMessage());
96101
}

src/Client/OrchestrationServiceClientShim/ShimDurableTaskClient.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System.Diagnostics;
45
using System.Diagnostics.CodeAnalysis;
6+
using System.Globalization;
57
using DurableTask.Core;
68
using DurableTask.Core.History;
79
using DurableTask.Core.Query;
@@ -166,6 +168,16 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
166168
};
167169

168170
string? serializedInput = this.DataConverter.Serialize(input);
171+
172+
var tags = new Dictionary<string, string>();
173+
if (options?.Tags != null)
174+
{
175+
tags = options.Tags.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
176+
}
177+
178+
tags[OrchestrationTags.CreateTraceForNewOrchestration] = "true";
179+
tags[OrchestrationTags.RequestTime] = DateTimeOffset.UtcNow.ToString(CultureInfo.InvariantCulture);
180+
169181
TaskMessage message = new()
170182
{
171183
OrchestrationInstance = instance,
@@ -175,7 +187,8 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
175187
Version = options?.Version ?? string.Empty,
176188
OrchestrationInstance = instance,
177189
ScheduledStartTime = options?.StartAt?.UtcDateTime,
178-
Tags = options?.Tags != null ? options.Tags.ToDictionary(kvp => kvp.Key, kvp => kvp.Value) : null,
190+
ParentTraceContext = Activity.Current is { } activity ? new Core.Tracing.DistributedTraceContext(activity.Id!, activity.TraceStateString) : null,
191+
Tags = tags,
179192
},
180193
};
181194

src/Grpc/orchestrator_service.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ message TaskScheduledEvent {
9595
google.protobuf.StringValue version = 2;
9696
google.protobuf.StringValue input = 3;
9797
TraceContext parentTraceContext = 4;
98+
map<string, string> tags = 5;
9899
}
99100

100101
message TaskCompletedEvent {
@@ -256,6 +257,7 @@ message ScheduleTaskAction {
256257
string name = 1;
257258
google.protobuf.StringValue version = 2;
258259
google.protobuf.StringValue input = 3;
260+
map<string, string> tags = 4;
259261
}
260262

261263
message CreateSubOrchestrationAction {
@@ -343,6 +345,7 @@ message CreateInstanceRequest {
343345
google.protobuf.StringValue executionId = 7;
344346
map<string, string> tags = 8;
345347
TraceContext parentTraceContext = 9;
348+
google.protobuf.Timestamp requestTime = 10;
346349
}
347350

348351
message OrchestrationIdReusePolicy {
@@ -490,6 +493,8 @@ message SignalEntityRequest {
490493
google.protobuf.StringValue input = 3;
491494
string requestId = 4;
492495
google.protobuf.Timestamp scheduledTime = 5;
496+
TraceContext parentTraceContext = 6;
497+
google.protobuf.Timestamp requestTime = 7;
493498
}
494499

495500
message SignalEntityResponse {
@@ -575,6 +580,7 @@ message OperationRequest {
575580
string operation = 1;
576581
string requestId = 2;
577582
google.protobuf.StringValue input = 3;
583+
TraceContext traceContext = 4;
578584
}
579585

580586
message OperationResult {
@@ -591,10 +597,14 @@ message OperationInfo {
591597

592598
message OperationResultSuccess {
593599
google.protobuf.StringValue result = 1;
600+
google.protobuf.Timestamp startTimeUtc = 2;
601+
google.protobuf.Timestamp endTimeUtc = 3;
594602
}
595603

596604
message OperationResultFailure {
597605
TaskFailureDetails failureDetails = 1;
606+
google.protobuf.Timestamp startTimeUtc = 2;
607+
google.protobuf.Timestamp endTimeUtc = 3;
598608
}
599609

600610
message OperationAction {
@@ -610,6 +620,8 @@ message SendSignalAction {
610620
string name = 2;
611621
google.protobuf.StringValue input = 3;
612622
google.protobuf.Timestamp scheduledTime = 4;
623+
google.protobuf.Timestamp requestTime = 5;
624+
TraceContext parentTraceContext = 6;
613625
}
614626

615627
message StartNewOrchestrationAction {
@@ -618,6 +630,8 @@ message StartNewOrchestrationAction {
618630
google.protobuf.StringValue version = 3;
619631
google.protobuf.StringValue input = 4;
620632
google.protobuf.Timestamp scheduledTime = 5;
633+
google.protobuf.Timestamp requestTime = 6;
634+
TraceContext parentTraceContext = 7;
621635
}
622636

623637
message AbandonActivityTaskRequest {

0 commit comments

Comments
 (0)