public Task Handle(BatchSubmissionCompletedEvent notification, CancellationToken cancellationToken) { using (var scope = TracingExtensions.StartServerSpan( _tracer, notification.TracingKeys, "batch-submission-completion")) { try { _logger.LogInformation( "Batch submission completion handled - URI: {BatchUri}", notification.BatchUri); } catch (Exception e) { scope.Span.Log(new Dictionary <string, object>() { { "exception", e } }); Tags.Error.Set(scope.Span, true); } return(Task.CompletedTask); } }
public Task Handle(BatchSubmissionCompletedEvent notification, CancellationToken cancellationToken) { using (var scope = TracingExtensions.StartServerSpan( _tracer, notification.TracingKeys, "batch-vetting-initiating")) { try { _logger.LogInformation( "Batch vetting initiated - URI: {BatchUri}", notification.BatchUri); var batchJobData = new BatchJobData { BatchUri = notification.BatchUri, TracingKeys = notification.TracingKeys }; _backgroundJobClient .Enqueue <VetBatchJob>( job => job.Execute(batchJobData, null, JobCancellationToken.Null)); } catch (Exception e) { scope.Span.Log(new Dictionary <string, object>() { { "exception", e } }); Tags.Error.Set(scope.Span, true); } return(Task.CompletedTask); } }
public void HttpResponseMessageAsFormattedStringHandlesEmptyRequests() { using (var httpRequest = new HttpResponseMessage()) { var formattedString = TracingExtensions.AsFormattedString(httpRequest); Assert.Contains("StatusCode: 200", formattedString); } }
public void HttpRequestMessageAsFormattedStringHandlesEmptyRequests() { using (var httpRequest = new HttpRequestMessage()) { var formattedString = TracingExtensions.AsFormattedString(httpRequest); Assert.Contains("Method: GET", formattedString); } }
public void HttpResponseMessageAsFormattedStringHandlesRequestsWithHeaders() { using (var httpRequest = new HttpResponseMessage(HttpStatusCode.OK)) { httpRequest.Headers.Add("x-ms-version", "2013-11-01"); var formattedString = TracingExtensions.AsFormattedString(httpRequest); Assert.Contains("StatusCode: 200", formattedString); Assert.Contains("x-ms-version: 2013-11-01", formattedString); } }
public void DictionaryAsFormattedStringWorksWithNulls() { var parameters = new Dictionary <string, object>(); parameters["a"] = 1; parameters["b"] = "str"; parameters["c"] = null; var formattedString = TracingExtensions.AsFormattedString(parameters); Assert.Equal("{a=1,b=str,c=}", formattedString); }
public void DictionaryAsFormattedStringReturnsSet() { var parameters = new Dictionary <string, object>(); parameters["a"] = 1; parameters["b"] = "str"; parameters["c"] = true; var formattedString = TracingExtensions.AsFormattedString(parameters); Assert.Equal("{a=1,b=str,c=True}", formattedString); }
public void HttpResponseMessageAsFormattedStringHandlesRequestsWithContent() { using (var httpRequest = new HttpResponseMessage(HttpStatusCode.OK)) { httpRequest.Content = new StringContent("<body/>"); var formattedString = TracingExtensions.AsFormattedString(httpRequest); Assert.Contains("StatusCode: 200", formattedString); Assert.Contains("<body/>", formattedString); } }
public void HttpRequestMessageAsFormattedStringHandlesRequestsWithContent() { using (var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test")) { httpRequest.Content = new StringContent("<body/>"); var formattedString = TracingExtensions.AsFormattedString(httpRequest); Assert.Contains("Method: GET", formattedString); Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", formattedString); Assert.Contains("<body/>", formattedString); } }
public void HttpRequestMessageAsFormattedStringHandlesRequestsWithHeaders() { using (var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test")) { httpRequest.Headers.Add("x-ms-version", "2013-11-01"); var formattedString = TracingExtensions.AsFormattedString(httpRequest); Assert.Contains("Method: GET", formattedString); Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", formattedString); Assert.Contains("x-ms-version: 2013-11-01", formattedString); } }
public async Task Execute(BatchJobData batchJobData, PerformContext context, IJobCancellationToken cancellationToken) { using (TracingExtensions.StartServerSpan(_tracer, batchJobData.TracingKeys, "batch-submission-feedback-generation")) { context.WriteLine($"Generating feedback doc for batch {batchJobData.BatchId}"); var batch = await _batchRepository.BatchForIdAsync(batchJobData.BatchId); var feedbackUri = _batchUriGenerator.GenerateSubmissionFeedbackUri(batch.GetBatchUri); await batch.GenerateSubmissionFeedbackAsync( feedbackUri, _batchSubmissionFeedbackStoreService); await _batchRepository.SaveChangesAsync(cancellationToken.ShutdownToken); } }
public async Task Execute(BatchJobData batchJobData, PerformContext context, IJobCancellationToken cancellationToken) { using (TracingExtensions.StartServerSpan(_tracer, batchJobData.TracingKeys, "batch-vetting-job")) { context.WriteLine($"Generating feedback doc for batch {batchJobData.BatchUri}"); var batch = await Batch.CreateAsync( batchJobData.BatchUri, _batchContentService); _batchRepository.AddBatch(batch); await _batchRepository.SaveChangesAsync(cancellationToken.ShutdownToken); await batch.Vet( _batchReportUriGenerator.GenerateVettingReportUri(batch.GetBatchUri), _vettingPlugins, _batchVettingReportStoreService); await _batchRepository.SaveChangesAsync(cancellationToken.ShutdownToken); } }
public void HttpResponseMessageAsFormattedStringThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => TracingExtensions.AsFormattedString((HttpResponseMessage)null)); }
public void DictionaryAsFormattedStringReturnsEmptyBracesForEmptySet() { var formattedString = TracingExtensions.AsFormattedString(new Dictionary <string, object>()); Assert.Equal("{}", formattedString); }
public void DictionaryAsFormattedStringReturnsEmptyBracesForNull() { var formattedString = TracingExtensions.AsFormattedString((Dictionary <string, object>)null); Assert.Equal("{}", formattedString); }