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);
        }
Exemple #3
0
        public void Log(IPerformanceMarker marker)
        {
            _logger.Log(marker);

            IPerformanceAggregate ag = GetPerformanceAggregate();

            if (ag != null)
            {
                ag.AppendMarker(marker);
            }
        }
Exemple #4
0
        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);
        }