Ejemplo n.º 1
0
        /// <summary>
        /// Process the specified log entries.
        /// </summary>
        /// <param name="logEntries">Log entries to process.</param>
        /// <returns>Number of processed entries. It may be less then the number of specified entries if some of the entries are rejected.</returns>
        public int Process(IEnumerable <ILogEntry> logEntries)
        {
            var processedRequests = 0;

            foreach (var logEntry in logEntries)
            {
                if (logEntry.TimeStampUtc >= this.MonitoredPeriodUtc.Start)
                {
                    this.GlobalStatistics.Process(logEntry);

                    var key = logEntry.TimeStampUtc.Floor(this.MonitoredPeriodUtc.Duration);
                    if (this.PeriodicStatistics.TryGetValue(key, out var statistics))
                    {
                        statistics.Process(logEntry);
                    }
                    else
                    {
                        statistics = new StatisticsCollection();
                        this.PeriodicStatistics[key] = statistics;
                        statistics.Process(logEntry);
                    }

                    processedRequests++;
                }
            }

            return(processedRequests);
        }
Ejemplo n.º 2
0
 public ReportItem(DateTime periodStart, DateTime?periodEnd, StatisticsCollection statistics)
 {
     this.PeriodStart = periodStart;
     this.PeriodEnd   = periodEnd;
     this.Statistics  = statistics;
 }