diff --git a/src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs b/src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs index c4f01eefb869..55c4cf94d692 100644 --- a/src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs +++ b/src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs @@ -38,6 +38,8 @@ public class Constants public const string ClientRequestIdHeaderName = "x-ms-client-request-id"; + public const string ActivityIdHeaderName = "x-ms-activity-id"; + // default schedule expiry time for daily schedule, consistent with UX // 12/31/9999 12:00:00 AM public static readonly DateTimeOffset DefaultScheduleExpiryTime = DateTimeOffset.MaxValue; diff --git a/src/ResourceManager/Automation/Commands.Automation/Common/RequestSettings.cs b/src/ResourceManager/Automation/Commands.Automation/Common/RequestSettings.cs index b8e7ba5fef6b..b6eaa983552c 100644 --- a/src/ResourceManager/Automation/Commands.Automation/Common/RequestSettings.cs +++ b/src/ResourceManager/Automation/Commands.Automation/Common/RequestSettings.cs @@ -14,6 +14,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.Eventing; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -31,6 +32,11 @@ public RequestSettings(IAutomationManagementClient automationClient) client = ((AutomationManagementClient)automationClient); client.HttpClient.DefaultRequestHeaders.Remove(Constants.ClientRequestIdHeaderName); client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, Guid.NewGuid().ToString()); + + client.HttpClient.DefaultRequestHeaders.Remove(Constants.ActivityIdHeaderName); + var activityId = Guid.NewGuid(); + EventProvider.SetActivityId(ref activityId); + client.HttpClient.DefaultRequestHeaders.Add(Constants.ActivityIdHeaderName, activityId.ToString()); } public void Dispose() @@ -43,6 +49,7 @@ protected virtual void Dispose(bool disposing) if (disposing) { client.HttpClient.DefaultRequestHeaders.Remove(Constants.ClientRequestIdHeaderName); + client.HttpClient.DefaultRequestHeaders.Remove(Constants.ActivityIdHeaderName); } } }