Skip to content

Commit

Permalink
Merge pull request #10 from adamblev/dev
Browse files Browse the repository at this point in the history
Adding x-ms-activity-id header to RequestSettings
  • Loading branch information
adamblev committed Nov 17, 2015
2 parents 4c5410b + 0ae93b4 commit bb0a6a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.Eventing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -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()
Expand All @@ -43,6 +49,7 @@ protected virtual void Dispose(bool disposing)
if (disposing)
{
client.HttpClient.DefaultRequestHeaders.Remove(Constants.ClientRequestIdHeaderName);
client.HttpClient.DefaultRequestHeaders.Remove(Constants.ActivityIdHeaderName);
}
}
}
Expand Down

0 comments on commit bb0a6a4

Please sign in to comment.