public async Task Invoke(HttpContext context) { Stopwatch sw = Stopwatch.StartNew(); try { await this.next(context).ConfigureAwait(false); MyDiagnosticSource.LogIncomingRequest(context, sw.Elapsed); } catch (Exception ex) { MyDiagnosticSource.LogIncomingRequestException(context, ex, sw.Elapsed); } }
public void OnAfterResponse(CorrelationContext context, HttpResponseMessage response) { DateTimeOffset startTime = (DateTimeOffset)response.RequestMessage.Properties["start"]; MyDiagnosticSource.LogOutgoigRequest(response, DateTimeOffset.Now - startTime); }