protected override void Harvest()
        {
            ConcurrentPriorityQueue <PrioritizedNode <ErrorEventWireModel> > originalErrorEvents;
            ConcurrentList <ErrorEventWireModel> originalSyntheticsErrorEvents;

            _readerWriterLock.EnterWriteLock();
            try
            {
                originalErrorEvents           = GetAndResetErrorEvents(GetReservoirSize());
                originalSyntheticsErrorEvents = GetAndResetSyntheticsErrorEvents();
            }
            finally
            {
                _readerWriterLock.ExitWriteLock();
            }

            var errorEvents      = originalErrorEvents.Where(node => node != null).Select(node => node.Data).ToList();
            var aggregatedEvents = errorEvents.Union(originalSyntheticsErrorEvents).ToList();

            // Retrieve the number of add attempts before resetting the collection.
            var eventHarvestData = new EventHarvestData(originalErrorEvents.Size, originalErrorEvents.GetAddAttemptsCount());

            // if we don't have any events to publish then don't
            if (aggregatedEvents.Count <= 0)
            {
                return;
            }

            var responseStatus = DataTransportService.Send(eventHarvestData, aggregatedEvents);

            HandleResponse(responseStatus, aggregatedEvents);
        }
        protected override void Harvest()
        {
            ConcurrentPriorityQueue <PrioritizedNode <ISpanEventWireModel> > spanEventsPriorityQueue;

            _readerWriterLockSlim.EnterWriteLock();
            try
            {
                spanEventsPriorityQueue = GetAndResetCollection();
            }
            finally
            {
                _readerWriterLockSlim.ExitWriteLock();
            }

            var eventHarvestData = new EventHarvestData(spanEventsPriorityQueue.Size, spanEventsPriorityQueue.GetAddAttemptsCount());
            var wireModels       = spanEventsPriorityQueue.Where(node => null != node).Select(node => node.Data).ToList();

            // if we don't have any events to publish then don't
            if (wireModels.Count <= 0)
            {
                return;
            }

            var responseStatus = DataTransportService.Send(eventHarvestData, wireModels);

            HandleResponse(responseStatus, wireModels);
        }
Пример #3
0
        protected override void Harvest()
        {
            IResizableCappedCollection <PrioritizedNode <TransactionEventWireModel> > originalTransactionEvents;
            ConcurrentList <TransactionEventWireModel> originalSyntheticsTransactionEvents;

            _readerWriterLock.EnterWriteLock();
            try
            {
                originalTransactionEvents           = GetAndResetRegularTransactionEvents(_transactionEvents.Size);
                originalSyntheticsTransactionEvents = GetAndResetSyntheticsTransactionEvents();
            }
            finally
            {
                _readerWriterLock.ExitWriteLock();
            }

            var transactionEvents = originalTransactionEvents.Where(node => node != null).Select(node => node.Data).ToList();
            var aggregatedEvents  = transactionEvents.Union(originalSyntheticsTransactionEvents).ToList();

            // EventHarvestData is required for extrapolation in the UI.
            var eventHarvestData = new EventHarvestData(originalTransactionEvents.Size, originalTransactionEvents.GetAddAttemptsCount());

            // if we don't have any events to publish then don't
            if (aggregatedEvents.Count <= 0)
            {
                return;
            }

            var responseStatus = DataTransportService.Send(eventHarvestData, aggregatedEvents);

            HandleResponse(responseStatus, aggregatedEvents);
        }