public SpanEventAggregatorInfiniteTracing(IDataStreamingService <Span, SpanBatch, RecordStatus> spanStreamingService, IConfigurationService configSvc, IAgentHealthReporter agentHealthReporter, IScheduler scheduler) { _spanStreamingService = spanStreamingService; _subscriptions.Add <AgentConnectedEvent>(AgentConnected); _agentHealthReporter = agentHealthReporter; _configSvc = configSvc; _schedulerSvc = scheduler; }
public void SetUp() { var configuration = GetDefaultConfiguration(); Mock.Arrange(() => configuration.CollectorSendDataOnExit).Returns(true); Mock.Arrange(() => configuration.CollectorSendDataOnExitThreshold).Returns(0); Mock.Arrange(() => configuration.SpanEventsHarvestCycle).Returns(ConfiguredHarvestCycle); _configurationAutoResponder = new ConfigurationAutoResponder(configuration); _dataTransportService = Mock.Create <IDataTransportService>(); _spanStreamingService = Mock.Create <IDataStreamingService <Span, SpanBatch, RecordStatus> >(); _agentHealthReporter = Mock.Create <IAgentHealthReporter>(); _processStatic = Mock.Create <IProcessStatic>(); _scheduler = Mock.Create <IScheduler>(); Mock.Arrange(() => _scheduler.ExecuteEvery(Arg.IsAny <Action>(), Arg.IsAny <TimeSpan>(), Arg.IsAny <TimeSpan?>())) .DoInstead <Action, TimeSpan, TimeSpan?>((action, harvestCycle, __) => { _harvestAction = action; _harvestCycle = harvestCycle; _actualWillHarvest = true; }); Mock.Arrange(() => _scheduler.StopExecuting(Arg.IsAny <Action>(), Arg.IsAny <TimeSpan?>())) .DoInstead <Action, TimeSpan?>((action, __) => { _actualWillHarvest = false; }); _actualWillHarvest = false; _spanEventAggregator = new SpanEventAggregator(_dataTransportService, _scheduler, _processStatic, _agentHealthReporter); EventBus <AgentConnectedEvent> .Publish(new AgentConnectedEvent()); }
private ISpanEventAggregatorInfiniteTracing CreateAggregator(IDataStreamingService <Span, SpanBatch, RecordStatus> streamingSvc) { var aggregator = new SpanEventAggregatorInfiniteTracing(streamingSvc, _mockConfigService, _mockAgentHealthReporter, _mockScheduler); return(aggregator); }