Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Add automatic retry on gateway timeout in `GrpcDurableTaskClient.WaitForInstanceCompletionAsync` in ([#412](https://github.com/microsoft/durabletask-dotnet/pull/412))
- Add specific logging for NotFound error on worker connection by @halspang in ([#413](https://github.com/microsoft/durabletask-dotnet/pull/413))
- Add user agent header to gRPC called in ([#417](https://github.com/microsoft/durabletask-dotnet/pull/417))

- Enrich User-Agent Header in gRPC Metadata to indicate Client or Worker as caller ([#421](https://github.com/microsoft/durabletask-dotnet/pull/421))
## v1.10.0

- Update DurableTask.Core to v3.1.0 and Bump version to v1.10.0 by @nytian in ([#411](https://github.com/microsoft/durabletask-dotnet/pull/411))
Expand Down
3 changes: 2 additions & 1 deletion src/Client/AzureManaged/DurableTaskSchedulerClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Grpc.Core;
using Grpc.Net.Client;
using Microsoft.DurableTask;
using Microsoft.DurableTask.Client;

namespace Microsoft.DurableTask;

Expand Down Expand Up @@ -98,7 +99,7 @@ this.Credential is not null
metadata.Add("taskhub", taskHubName);

// Add user agent header with durabletask-dotnet and DLL version from util
metadata.Add("user-agent", $"{DurableTaskUserAgentUtil.GetUserAgent()}");
metadata.Add("user-agent", $"{DurableTaskUserAgentUtil.GetUserAgent(nameof(DurableTaskClient))}");
if (cache == null)
{
return;
Expand Down
7 changes: 4 additions & 3 deletions src/Shared/AzureManaged/DurableTaskVersionUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
/// <summary>
/// The version of the SDK used in the user agent string.
/// </summary>
static readonly string PackageVersion = FileVersionInfo.GetVersionInfo(typeof(DurableTaskUserAgentUtil).Assembly.Location).FileVersion;

Check warning on line 21 in src/Shared/AzureManaged/DurableTaskVersionUtil.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.

/// <summary>
/// Generates the user agent string for the Durable Task SDK based on a fixed name and the package version.
/// Generates the user agent string for the Durable Task SDK based on a fixed name, the package version, and the caller type.
/// </summary>
/// <param name="callerType">The type of caller (Client or Worker).</param>
/// <returns>The user agent string.</returns>
public static string GetUserAgent()
public static string GetUserAgent(string callerType)
{
return $"{SdkName}/{PackageVersion?.ToString() ?? "unknown"}";
return $"{SdkName}/{PackageVersion?.ToString() ?? "unknown"} ({callerType})";
}
}
3 changes: 2 additions & 1 deletion src/Worker/AzureManaged/DurableTaskSchedulerWorkerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Grpc.Core;
using Grpc.Net.Client;
using Microsoft.DurableTask;
using Microsoft.DurableTask.Worker.Hosting;

namespace Microsoft.DurableTask;

Expand Down Expand Up @@ -103,7 +104,7 @@ this.Credential is not null
{
metadata.Add("taskhub", taskHubName);
// Add user agent header with durabletask-dotnet and DLL version from util
metadata.Add("user-agent", $"{DurableTaskUserAgentUtil.GetUserAgent()}");
metadata.Add("user-agent", $"{DurableTaskUserAgentUtil.GetUserAgent(nameof(DurableTaskWorker))}");
metadata.Add("workerid", this.WorkerId);
if (cache == null)
{
Expand Down
Loading