Skip to content

Commit 6288cea

Browse files
committed
Merge branch 'main' into philliphoff-orchestration-tracing
2 parents 5a5c199 + 46bf417 commit 6288cea

19 files changed

+541
-40
lines changed

CHANGELOG.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,27 @@
22

33
## (Unreleased)
44

5-
- Add New Property Properties to TaskOrchestrationContext by @nytian in [#415](https://github.com/microsoft/durabletask-dotnet/pull/415)
6-
- Add automatic retry on gateway timeout in `GrpcDurableTaskClient.WaitForInstanceCompletionAsync` in [#412](https://github.com/microsoft/durabletask-dotnet/pull/412))
7-
- Add specific logging for NotFound error on worker connection by @halspang in ([#413](https://github.com/microsoft/durabletask-dotnet/pull/413))
8-
- Add user agent header to gRPC called in ([#417](https://github.com/microsoft/durabletask-dotnet/pull/417))
5+
- Expose gRPC retry options in Azure Managed extensions ([#447](https://github.com/microsoft/durabletask-dotnet/pull/447))
6+
7+
## v1.12.0
8+
9+
- Activity tag support ([#426](https://github.com/microsoft/durabletask-dotnet/pull/426))
10+
- Adding Analyzer to build and release ([#444](https://github.com/microsoft/durabletask-dotnet/pull/444))
11+
- Add ability to filter orchestrations at worker ([#443](https://github.com/microsoft/durabletask-dotnet/pull/443))
12+
- Removing breaking change for TaskOptions ([#446](https://github.com/microsoft/durabletask-dotnet/pull/446))
13+
14+
## v1.11.0
15+
16+
- Add New Property Properties to TaskOrchestrationContext ([#415](https://github.com/microsoft/durabletask-dotnet/pull/415))
17+
- Add automatic retry on gateway timeout in `GrpcDurableTaskClient.WaitForInstanceCompletionAsync` ([#412](https://github.com/microsoft/durabletask-dotnet/pull/412))
18+
- Add specific logging for NotFound error on worker connection ([#413](https://github.com/microsoft/durabletask-dotnet/pull/413))
19+
- Add user agent header to gRPC called ([#417](https://github.com/microsoft/durabletask-dotnet/pull/417))
920
- Enrich User-Agent Header in gRPC Metadata to indicate Client or Worker as caller ([#421](https://github.com/microsoft/durabletask-dotnet/pull/421))
21+
- Change DTS user agent metadata to avoid overlap with gRPC user agent ([#423](https://github.com/microsoft/durabletask-dotnet/pull/423))
1022
- Add extension methods for registering entities by type ([#427](https://github.com/microsoft/durabletask-dotnet/pull/427))
1123
- Add TaskVersion and utilize it for version overrides when starting orchestrations ([#416](https://github.com/microsoft/durabletask-dotnet/pull/416))
24+
- Update sub-orchestration default versioning ([#437](https://github.com/microsoft/durabletask-dotnet/pull/437))
25+
- Distributed Tracing for Entities (Isolated) ([#404](https://github.com/microsoft/durabletask-dotnet/pull/404))
1226

1327
## v1.10.0
1428

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.11.0</VersionPrefix>
20+
<VersionPrefix>1.12.0</VersionPrefix>
2121
<VersionSuffix></VersionSuffix>
2222
</PropertyGroup>
2323

src/Abstractions/TaskOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public record TaskOptions
1414
/// Initializes a new instance of the <see cref="TaskOptions"/> class.
1515
/// </summary>
1616
/// <param name="retry">The task retry options.</param>
17-
public TaskOptions(TaskRetryOptions? retry = null)
17+
public TaskOptions(TaskRetryOptions? retry)
18+
: this(retry, null)
1819
{
19-
this.Retry = retry;
2020
}
2121

2222
/// <summary>
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
; Shipped analyzer releases
2-
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
2+
; https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
33

4+
## Release 0.1.0
5+
6+
### New Rules
7+
8+
Rule ID | Category | Severity | Notes
9+
--------|----------|----------|-------
10+
DURABLE0001 | Orchestration | Warning | DateTimeOrchestrationAnalyzer
11+
DURABLE0002 | Orchestration | Warning | GuidOrchestrationAnalyzer
12+
DURABLE0003 | Orchestration | Warning | DelayOrchestrationAnalyzer
13+
DURABLE0004 | Orchestration | Warning | ThreadTaskOrchestrationAnalyzer
14+
DURABLE0005 | Orchestration | Warning | IOOrchestrationAnalyzer
15+
DURABLE0006 | Orchestration | Warning | EnvironmentOrchestrationAnalyzer
16+
DURABLE0007 | Orchestration | Warning | CancellationTokenOrchestrationAnalyzer
17+
DURABLE0008 | Orchestration | Warning | OtherBindingsOrchestrationAnalyzer
18+
DURABLE1001 | Attribute Binding | Error | OrchestrationTriggerBindingAnalyzer
19+
DURABLE1002 | Attribute Binding | Error | DurableClientBindingAnalyzer
20+
DURABLE1003 | Attribute Binding | Error | EntityTriggerBindingAnalyzer
21+
DURABLE2001 | Activity | Warning | MatchingInputOutputTypeActivityAnalyzer
22+
DURABLE2002 | Activity | Warning | MatchingInputOutputTypeActivityAnalyzer
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,2 @@
11
; Unshipped analyzer release
2-
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
3-
4-
### New Rules
5-
6-
Rule ID | Category | Severity | Notes
7-
--------|----------|----------|-------
8-
DURABLE0001 | Orchestration | Warning | DateTimeOrchestrationAnalyzer
9-
DURABLE0002 | Orchestration | Warning | GuidOrchestrationAnalyzer
10-
DURABLE0003 | Orchestration | Warning | DelayOrchestrationAnalyzer
11-
DURABLE0004 | Orchestration | Warning | ThreadTaskOrchestrationAnalyzer
12-
DURABLE0005 | Orchestration | Warning | IOOrchestrationAnalyzer
13-
DURABLE0006 | Orchestration | Warning | EnvironmentOrchestrationAnalyzer
14-
DURABLE0007 | Orchestration | Warning | CancellationTokenOrchestrationAnalyzer
15-
DURABLE0008 | Orchestration | Warning | OtherBindingsOrchestrationAnalyzer
16-
DURABLE1001 | Attribute Binding | Error | OrchestrationTriggerBindingAnalyzer
17-
DURABLE1002 | Attribute Binding | Error | DurableClientBindingAnalyzer
18-
DURABLE1003 | Attribute Binding | Error | EntityTriggerBindingAnalyzer
19-
DURABLE2001 | Activity | Warning | MatchingInputOutputTypeActivityAnalyzer
20-
DURABLE2002 | Activity | Warning | MatchingInputOutputTypeActivityAnalyzer
2+
; https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

src/Analyzers/Analyzers.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
</PropertyGroup>
1212

1313
<PropertyGroup>
14-
<VersionPrefix>0.0.1</VersionPrefix>
15-
<VersionSuffix>preview.1</VersionSuffix>
14+
<VersionPrefix>0.1.0</VersionPrefix>
15+
<VersionSuffix></VersionSuffix>
1616
<PackageDescription>.NET Analyzers for the Durable Task SDK.</PackageDescription>
1717
<NeutralLanguage>en</NeutralLanguage>
1818
<IncludeBuildOutput>false</IncludeBuildOutput> <!-- Do not include the analyzer as a lib dependency -->
1919
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
20-
<IsPackable>false</IsPackable> <!-- Do not publish it until it is ready to release -->
20+
<IsPackable>true</IsPackable>
2121
</PropertyGroup>
2222

2323
<ItemGroup>

src/Client/AzureManaged/DurableTaskSchedulerClientOptions.cs

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
using Azure.Identity;
77
using Grpc.Core;
88
using Grpc.Net.Client;
9-
using Microsoft.DurableTask;
109
using Microsoft.DurableTask.Client;
10+
using GrpcConfig = Grpc.Net.Client.Configuration;
1111

1212
namespace Microsoft.DurableTask;
1313

@@ -46,6 +46,11 @@ public class DurableTaskSchedulerClientOptions
4646
/// </summary>
4747
public bool AllowInsecureCredentials { get; set; }
4848

49+
/// <summary>
50+
/// Gets or sets the options that determine how and when calls made to the scheduler will be retried.
51+
/// </summary>
52+
public ClientRetryOptions? RetryOptions { get; set; }
53+
4954
/// <summary>
5055
/// Creates a new instance of <see cref="DurableTaskSchedulerClientOptions"/> from a connection string.
5156
/// </summary>
@@ -109,6 +114,45 @@ this.Credential is not null
109114
metadata.Add("Authorization", $"Bearer {token.Token}");
110115
});
111116

117+
GrpcConfig.ServiceConfig? serviceConfig = GrpcRetryPolicyDefaults.DefaultServiceConfig;
118+
if (this.RetryOptions != null)
119+
{
120+
GrpcConfig.RetryPolicy retryPolicy = new GrpcConfig.RetryPolicy
121+
{
122+
MaxAttempts = this.RetryOptions.MaxRetries ?? GrpcRetryPolicyDefaults.DefaultMaxAttempts,
123+
InitialBackoff = TimeSpan.FromMilliseconds(this.RetryOptions.InitialBackoffMs ?? GrpcRetryPolicyDefaults.DefaultInitialBackoffMs),
124+
MaxBackoff = TimeSpan.FromMilliseconds(this.RetryOptions.MaxBackoffMs ?? GrpcRetryPolicyDefaults.DefaultMaxBackoffMs),
125+
BackoffMultiplier = this.RetryOptions.BackoffMultiplier ?? GrpcRetryPolicyDefaults.DefaultBackoffMultiplier,
126+
RetryableStatusCodes = { StatusCode.Unavailable }, // Always retry on Unavailable.
127+
};
128+
129+
if (this.RetryOptions.RetryableStatusCodes != null)
130+
{
131+
foreach (StatusCode statusCode in this.RetryOptions.RetryableStatusCodes)
132+
{
133+
// Added by default, don't need to have it added twice.
134+
if (statusCode == StatusCode.Unavailable)
135+
{
136+
continue;
137+
}
138+
139+
retryPolicy.RetryableStatusCodes.Add(statusCode);
140+
}
141+
}
142+
143+
GrpcConfig.MethodConfig methodConfig = new GrpcConfig.MethodConfig
144+
{
145+
// MethodName.Default applies this retry policy configuration to all gRPC methods on the channel.
146+
Names = { GrpcConfig.MethodName.Default },
147+
RetryPolicy = retryPolicy,
148+
};
149+
150+
serviceConfig = new GrpcConfig.ServiceConfig
151+
{
152+
MethodConfigs = { methodConfig },
153+
};
154+
}
155+
112156
// Production will use HTTPS, but local testing will use HTTP
113157
ChannelCredentials channelCreds = endpoint.StartsWith("https://", StringComparison.OrdinalIgnoreCase) ?
114158
ChannelCredentials.SecureSsl :
@@ -117,7 +161,7 @@ this.Credential is not null
117161
{
118162
Credentials = ChannelCredentials.Create(channelCreds, managedBackendCreds),
119163
UnsafeUseInsecureChannelCallCredentials = this.AllowInsecureCredentials,
120-
ServiceConfig = GrpcRetryPolicyDefaults.DefaultServiceConfig,
164+
ServiceConfig = serviceConfig,
121165
});
122166
}
123167

@@ -173,4 +217,35 @@ this.Credential is not null
173217
nameof(connectionString));
174218
}
175219
}
220+
221+
/// <summary>
222+
/// Options used to configure retries used when making calls to the Scheduler.
223+
/// </summary>
224+
public class ClientRetryOptions
225+
{
226+
/// <summary>
227+
/// Gets or sets the maximum number of times a call should be retried.
228+
/// </summary>
229+
public int? MaxRetries { get; set; }
230+
231+
/// <summary>
232+
/// Gets or sets the initial backoff in milliseconds.
233+
/// </summary>
234+
public int? InitialBackoffMs { get; set; }
235+
236+
/// <summary>
237+
/// Gets or sets the maximum backoff in milliseconds.
238+
/// </summary>
239+
public int? MaxBackoffMs { get; set; }
240+
241+
/// <summary>
242+
/// Gets or sets the backoff multiplier for exponential backoff.
243+
/// </summary>
244+
public double? BackoffMultiplier { get; set; }
245+
246+
/// <summary>
247+
/// Gets or sets the list of status codes that can be retried.
248+
/// </summary>
249+
public IList<StatusCode>? RetryableStatusCodes { get; set; }
250+
}
176251
}

src/Shared/Shared.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<PackageReference Include="Microsoft.Azure.DurableTask.Core" />
1818
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
1919
<PackageReference Include="Microsoft.Extensions.Hosting" />
20+
<PackageReference Include="System.Text.Json"/>
2021
</ItemGroup>
2122

2223
</Project>

src/Worker/Core/DependencyInjection/DurableTaskWorkerBuilderExtensions.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,32 @@ public static IDurableTaskWorkerBuilder UseVersioning(this IDurableTaskWorkerBui
109109
});
110110
return builder;
111111
}
112+
113+
/// <summary>
114+
/// Adds an orchestration filter to the specified <see cref="IDurableTaskWorkerBuilder"/>.
115+
/// </summary>
116+
/// <param name="builder">The builder to set the builder target for.</param>
117+
/// <typeparam name="TOrchestrationFilter">The implementation of a <see cref="IOrchestrationFilter"/> that will be bound.</typeparam>
118+
/// <returns>The same <see cref="IDurableTaskWorkerBuilder"/> instance, allowing for method chaining.</returns>
119+
[Obsolete("Experimental")]
120+
public static IDurableTaskWorkerBuilder UseOrchestrationFilter<TOrchestrationFilter>(this IDurableTaskWorkerBuilder builder) where TOrchestrationFilter : class, IOrchestrationFilter
121+
{
122+
Check.NotNull(builder);
123+
builder.Services.AddSingleton<IOrchestrationFilter, TOrchestrationFilter>();
124+
return builder;
125+
}
126+
127+
/// <summary>
128+
/// Adds an orchestration filter to the specified <see cref="IDurableTaskWorkerBuilder"/>.
129+
/// </summary>
130+
/// <param name="builder">The builder to set the builder target for.</param>
131+
/// <param name="filter">The instance of an <see cref="IOrchestrationFilter"/> to use.</param>
132+
/// <returns>The same <see cref="IDurableTaskWorkerBuilder"/> instance, allowing for method chaining.</returns>
133+
[Obsolete("Experimental")]
134+
public static IDurableTaskWorkerBuilder UseOrchestrationFilter(this IDurableTaskWorkerBuilder builder, IOrchestrationFilter filter)
135+
{
136+
Check.NotNull(builder);
137+
builder.Services.AddSingleton(filter);
138+
return builder;
139+
}
112140
}

src/Worker/Core/DurableTaskWorkerOptions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ public DataConverter DataConverter
145145
/// </summary>
146146
public bool IsVersioningSet { get; internal set; }
147147

148+
/// <summary>
149+
/// Gets or sets a callback function that determines whether an orchestration should be accepted for work.
150+
/// </summary>
151+
[Obsolete("Experimental")]
152+
public IOrchestrationFilter? OrchestrationFilter { get; set; }
153+
148154
/// <summary>
149155
/// Gets a value indicating whether <see cref="DataConverter" /> was explicitly set or not.
150156
/// </summary>
@@ -156,6 +162,7 @@ public DataConverter DataConverter
156162
/// </remarks>
157163
internal bool DataConverterExplicitlySet { get; private set; }
158164

165+
159166
/// <summary>
160167
/// Applies these option values to another.
161168
/// </summary>
@@ -169,6 +176,7 @@ internal void ApplyTo(DurableTaskWorkerOptions other)
169176
other.MaximumTimerInterval = this.MaximumTimerInterval;
170177
other.EnableEntitySupport = this.EnableEntitySupport;
171178
other.Versioning = this.Versioning;
179+
other.OrchestrationFilter = this.OrchestrationFilter;
172180
}
173181
}
174182

0 commit comments

Comments
 (0)