protected override void CollectStatistics() { try { var statistics = new AuditorPerformanceStatistics { QuantaPerSecond = GetItemsPerSecond(), QuantaQueueLength = GetQuantaAvgLength(), BatchInfos = GetBatchInfos(), UpdateDate = DateTime.UtcNow }; OnUpdates?.Invoke(statistics); } catch (Exception exc) { logger.Error(exc); } }
private void ObserveUpdates() { try { foreach (var updates in awaitedUpdates.GetConsumingEnumerable(cancellationToken)) { OnUpdates?.Invoke(updates); } } catch (Exception exc) { if (exc is OperationCanceledException) { return; } logger.Error(exc); } }
private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e) { lock (syncRoot) { try { var quantaPerSecond = GetItemsPerSecond(); var throttling = GetThrottling(); OnUpdates?.Invoke(new PerformanceStatisticsManagerUpdate { BatchInfos = LastBatchInfos, QuantaPerSecond = quantaPerSecond, Trottling = throttling }); updateTimer?.Start(); } catch (Exception exc) { logger.Error(exc); } } }