Example #1
0
        public void Events_sent_reported_on_harvest()
        {
            // Arrange
            _errorEventAggregator.Collect(new ErrorEventWireModel(_attribValues, false, 0.1f));

            // Act
            _harvestAction();

            // Assert
            Mock.Assert(() => _agentHealthReporter.ReportErrorEventSeen());
            Mock.Assert(() => _agentHealthReporter.ReportErrorEventsSent(1));
        }
        private void HandleResponse(DataTransportResponseStatus responseStatus, ICollection <ErrorEventWireModel> errorEvents)
        {
            switch (responseStatus)
            {
            case DataTransportResponseStatus.RequestSuccessful:
                _agentHealthReporter.ReportErrorEventsSent(errorEvents.Count);
                break;

            case DataTransportResponseStatus.Retain:
                RetainEvents(errorEvents);
                break;

            case DataTransportResponseStatus.ReduceSizeIfPossibleOtherwiseDiscard:
                ReduceReservoirSize((int)(errorEvents.Count * ReservoirReductionSizeMultiplier));
                RetainEvents(errorEvents);
                break;

            case DataTransportResponseStatus.Discard:
            default:
                break;
            }
        }