Example #1
0
        public void Reservoir_resized_reported_on_post_too_big_response()
        {
            // Arrange
            _transactionEventAggregator.Collect(new TransactionEventWireModel(_attribValues, false, 0.1f));
            _transactionEventAggregator.Collect(new TransactionEventWireModel(_attribValues, false, 0.2f));
            Mock.Arrange(() => _dataTransportService.Send(Arg.IsAny <EventHarvestData>(), Arg.IsAny <IEnumerable <TransactionEventWireModel> >()))
            .Returns <EventHarvestData, IEnumerable <TransactionEventWireModel> >((_, events) =>
            {
                return(DataTransportResponseStatus.ReduceSizeIfPossibleOtherwiseDiscard);
            });

            // Act
            _harvestAction();

            // Assert
            Mock.Assert(() => _agentHealthReporter.ReportTransactionEventReservoirResized(1));
        }
Example #2
0
        private void ReduceReservoirSize(int newSize)
        {
            if (newSize >= GetReservoirSize())
            {
                return;
            }

            _transactionEvents.Resize(newSize);
            _agentHealthReporter.ReportTransactionEventReservoirResized(newSize);
        }