public void Log(IPerformanceLoggerItem item) { if (_resourceLogger != null) { _resourceLogger.Log(item); // run and forget } }
/// <summary> /// Stops the timer and logs the elapsed WcfExecutionTime /// </summary> public void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState) { var measurement = ((Stopwatch)correlationState).ElapsedMilliseconds; var data = new WcfPerformanceData(_contractName, operationName, _isClient ? "Client" : "Server", measurement); _log.Log(data); }
public void Log(IPerformanceMarker marker) { _logger.Log(marker); IPerformanceAggregate ag = GetPerformanceAggregate(); if (ag != null) { ag.AppendMarker(marker); } }
public async Task <TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate <TResponse> next) { // logic to measure performance..... stopwatch.Start(); var response = await next(); stopwatch.Stop(); string requestName = typeof(TRequest).Name; if (stopwatch.ElapsedMilliseconds > 1) { performanceLogger.Log(requestName, stopwatch.ElapsedMilliseconds, "", request.ToString(), DateTime.UtcNow); } return(response); }