Example #1
0
        public void Events_sent_reported_on_harvest()
        {
            // Arrange
            _customEventAggregator.Collect(new CustomEventWireModel(0.3f, GetCustomEventAttribs()));

            // Act
            _harvestAction();

            // Assert
            Mock.Assert(() => _agentHealthReporter.ReportCustomEventCollected());
            Mock.Assert(() => _agentHealthReporter.ReportCustomEventsSent(1));
        }
Example #2
0
        private void HandleResponse(DataTransportResponseStatus responseStatus, ICollection <CustomEventWireModel> customEvents)
        {
            switch (responseStatus)
            {
            case DataTransportResponseStatus.RequestSuccessful:
                _agentHealthReporter.ReportCustomEventsSent(customEvents.Count);
                break;

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

            case DataTransportResponseStatus.ReduceSizeIfPossibleOtherwiseDiscard:
                var newSize = (int)(customEvents.Count * ReservoirReductionSizeMultiplier);
                ReduceReservoirSize(newSize);
                RetainEvents(customEvents);
                break;

            case DataTransportResponseStatus.Discard:
            default:
                break;
            }
        }