private void ValidateQueueDependency( DependencyTelemetry dependency, string queueName, string operationName, string operationId, string requestId) { Assert.Equal("Azure queue", dependency.Type); Assert.True(dependency.Name.EndsWith(queueName)); TelemetryValidationHelpers.ValidateHttpDependency(dependency, operationName, operationId, requestId, LogCategories.Bindings); }
private void ValidateServiceBusDependency( DependencyTelemetry dependency, string endpoint, string queueName, string name, string operationName, string operationId, string parentId) { Assert.Equal($"{endpoint}/ | {queueName}", dependency.Target); Assert.Equal("Azure Service Bus", dependency.Type); Assert.Equal(name, dependency.Name); Assert.True(dependency.Success); Assert.True(string.IsNullOrEmpty(dependency.Data)); TelemetryValidationHelpers.ValidateDependency(dependency, operationName, operationId, parentId, LogCategories.Bindings); }
private void ValidateServiceBusRequest( RequestTelemetry request, string endpoint, string queueName, string operationName, string operationId, string parentId) { Assert.Equal($"type:Azure Service Bus | name:{queueName} | endpoint:{endpoint}/", request.Source); Assert.Null(request.Url); Assert.Equal(operationName, request.Name); Assert.True(request.Properties.ContainsKey(LogConstants.FunctionExecutionTimeKey)); Assert.True(double.TryParse(request.Properties[LogConstants.FunctionExecutionTimeKey], out double functionDuration)); Assert.True(request.Duration.TotalMilliseconds >= functionDuration); TelemetryValidationHelpers.ValidateRequest(request, operationName, operationId, parentId, LogCategories.Results); }
private void ValidateBlobDependency( DependencyTelemetry dependency, string containerName, string blobName, string operationName, string operationId, string requestId) { Assert.Equal("Azure blob", dependency.Type); Assert.Equal(containerName, dependency.Properties["Container"]); // container creation does not have blob info if (dependency.Properties.ContainsKey("Blob")) { Assert.Equal(blobName, dependency.Properties["Blob"]); } TelemetryValidationHelpers.ValidateHttpDependency(dependency, operationName, operationId, requestId, LogCategories.Bindings); }
public async Task UserCodeHttpCallsAreReported() { string testName = nameof(UserCodeHttpCall); using (var host = ConfigureHost(LogLevel.Information)) { await host.StartAsync(); await host.GetJobHost() .CallAsync(typeof(HttpDependencyCollectionTests).GetMethod(testName)); _functionWaitHandle.WaitOne(); await Task.Delay(1000); await host.StopAsync(); } RequestTelemetry request = _channel.Telemetries.OfType <RequestTelemetry>().Single(); List <DependencyTelemetry> dependencies = _channel.Telemetries.OfType <DependencyTelemetry>().ToList(); // exactly one Assert.Single(dependencies); DependencyTelemetry dependency = dependencies.Single(); TelemetryValidationHelpers.ValidateHttpDependency( dependency, testName, request.Context.Operation.Id, request.Id, LogCategories.CreateFunctionCategory(testName)); Assert.Equal("Http", dependency.Type); Assert.Equal("www.microsoft.com", dependency.Target); Assert.Contains("https://www.microsoft.com", dependency.Data); Assert.Equal("GET /en-us/", dependency.Name); }