public void SetUp() { metrics = Substitute.For <IMetrics>(); timer = Substitute.For <ITimer>(); timer.ElapsedMilliseconds.Returns(ElapsedMilliseconds); timerFactory = Substitute.For <Timer.Factory>(); timerFactory.Create().Returns(timer); actionRecorder = new ActionRecorder(metrics, timerFactory); logEvent = new DeveloperLogEvent { StatusCode = DeveloperEventStatus.Types.Code.Success, LatencyMilliseconds = ElapsedMilliseconds, LatencyType = DeveloperLogEvent.Types.LatencyType.LatencyTool }; }
public virtual void SetupStepTimeMetrics(List <IInterceptor> apiAspects, IMetrics metrics) { var schedulerFactory = new EventScheduler.Factory(); var timerFactory = new Timer.Factory(); var timer = timerFactory.Create(); var debugEventAggregator = new BatchEventAggregator <DebugEventBatch, DebugEventBatchParams, DebugEventBatchSummary>(_minimumDebugEventBatchSeparationInMillis, schedulerFactory, timer); var debugEventRecorder = new DebugEventRecorder(debugEventAggregator, metrics); var timeSource = GetTimeSource(); var metricsCollectionAspect = new MetricsCollectionAspect(debugEventRecorder, timeSource); apiAspects.Add(metricsCollectionAspect); }
public ExpressionEvaluationRecorder GetExpressionEvaluationRecorder() { if (_expressionEvaluationRecorder == null) { var schedulerFactory = new EventScheduler.Factory(); var timerFactory = new Timer.Factory(); ITimer timer = timerFactory.Create(); var expressionEvaluationEventAggregator = new BatchEventAggregator <ExpressionEvaluationBatch, ExpressionEvaluationBatchParams, ExpressionEvaluationBatchSummary>( _minimumDebugEventBatchSeparationInMillis, schedulerFactory, timer); _expressionEvaluationRecorder = new ExpressionEvaluationRecorder(expressionEvaluationEventAggregator, GetDebugSessionMetrics()); } return(_expressionEvaluationRecorder); }