public static HttpClient NewHttpClient(AvailabilityTestScope availabilityTestScope) { Validate.NotNull(availabilityTestScope, nameof(availabilityTestScope)); var httpClient = new HttpClient(); httpClient.SetAvailabilityTestRequestHeaders(availabilityTestScope); return(httpClient); }
public static AvailabilityTestScope StartNew(string testDisplayName, string locationDisplayName, TelemetryConfiguration telemetryConfig, bool flushOnDispose, ILogger log, object logScope) { log = AvailabilityTest.Log.CreateFallbackLogIfRequired(log); var testScope = new AvailabilityTestScope(testDisplayName, locationDisplayName, telemetryConfig, flushOnDispose, log, logScope); testScope.Start(); return(testScope); }
public static void SetAvailabilityTestRequestHeaders(this HttpClient httpClient, AvailabilityTestScope availabilityTestScope) { Validate.NotNull(httpClient, nameof(httpClient)); Validate.NotNull(availabilityTestScope, nameof(availabilityTestScope)); string testInfoDescriptor = availabilityTestScope.ActivitySpanOperationName; string testInvocationInstanceDescriptor = availabilityTestScope.DistributedOperationId; httpClient.SetAvailabilityTestRequestHeaders(testInfoDescriptor, testInvocationInstanceDescriptor); }