예제 #1
0
 public TaskRunner(ILogProvider logProvider, Func <string, Func <Task>, Exception, Task> callOnUnhandledException)
 {
     Assert.IsNotNull(logProvider, "logProvider");
     Assert.IsNotNull(callOnUnhandledException, "callOnUnhandledException");
     this.logger = logProvider.CreateLoggerInstance("TaskRunner");
     this.onUnhandledException = callOnUnhandledException;
 }
예제 #2
0
 public TraceStoreConnection(TraceStoreConnectionInformation traceConnectionInformation, ILogProvider logProvider)
 {
     Assert.IsNotNull(traceConnectionInformation, "Trace connection information can't be null");
     Assert.IsNotNull(logProvider, "Log Provider can't be null");
     this.logger = logProvider.CreateLoggerInstance("TraceStoreConnection");
     this.InitializeStore(traceConnectionInformation, logProvider);
 }
예제 #3
0
        protected BaseCallbackStore(IStoreProvider storeProvider, ITaskRunner taskRunner, ILogProvider logProvider, CancellationToken token)
        {
            Assert.IsNotNull(storeProvider, "Store Provider can't be null");
            Assert.IsNotNull(taskRunner, "Task Runner can't be null");
            Assert.IsNotNull(logProvider, "Log Provider can't be null");

            this.singleAccessLock = new SemaphoreSlim(1);
            this.callbackMap      = new Dictionary <NotifyFilter, IList <Func <ScenarioData, Task> > >();
            this.Logger           = logProvider.CreateLoggerInstance(this.GetType().ToString().Split('.').Last());
            this.taskRunner       = taskRunner;

            this.InternalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token);
            token = this.InternalTokenSource.Token;

            // Some signals may not show up immedietly so we don't want their last seen time bailing on us.
            this.callBackCheckPointTimeStore = storeProvider.CreatePersistentStoreForTimeAsync(CallbackTimeBookmarkStore, AgeBasedRetentionPolicy.OneDay, token)
                                               .GetAwaiter().GetResult();

            // This store keeps track of unique Ids of signals seen to avoid duplicate reporting. The entries in this
            // collection needs to be long lived. Consider a signal that is living in the system for a long time
            // If we don't track that this has been reported, we may try to report it again.
            this.reportedSignalsUniqueIdsStore = storeProvider
                                                 .CreatePersistentStoreKeyGuidValueStringAsync(ReportedSignalUniqueIdsStoreName, AgeBasedRetentionPolicy.OneWeek, token).GetAwaiter()
                                                 .GetResult();

            this.signalsInDispatchQueuePersistentStore = storeProvider
                                                         .CreatePersistentStoreKeyGuidValueStringAsync(SignalsInDispatchQueueStoreName, AgeBasedRetentionPolicy.OneHour, token).GetAwaiter().GetResult();

            this.producerConsumerBufferBlock = new BufferBlock <ScenarioNotificationData>();
            this.InitSignalSeenBookmarkStoreAsync(token).Wait(token);
        }
예제 #4
0
        public AnalysisScheduler(
            ILogProvider logProvider,
            IStoreProvider storeProvider,
            ITaskRunner taskRunner,
            TraceStoreConnection traceStoreConnection,
            CancellationToken token)
        {
            Assert.IsNotNull(logProvider, "Log Provider can't be null");
            Assert.IsNotNull(storeProvider, "Store Provider can't be null");
            Assert.IsNotNull(taskRunner, "Task Runner can't be null");
            Assert.IsNotNull(traceStoreConnection, "Trace store connection can't be null");

            this.Logger      = logProvider.CreateLoggerInstance(TracePrefix);
            this.TaskRunner  = taskRunner;
            this.consumerMap = new Dictionary <AgentIdentifier, IDictionary <IAnalysisConsumer, ConsumeOptions> >();
            this.CancelToken = token;

            // The in memory Caches for typed objects
            this.signalWaitingToBeProcessedMap = new ConcurrentDictionary <Guid, ConcurrentQueue <ScenarioData> >();

            this.analysisMetadataObjectStore = new TypedObjectStore <AnalysisMetadata>(
                this.Logger,
                storeProvider,
                AgentConstants.AnalysisMetadataStoreId,
                AgentConstants.AnalysisMetadataStoreRetentionPolicy,
                token);

            this.analysisContainerObjectStore = new TypedObjectStore <AnalysisContainer>(
                this.Logger,
                storeProvider,
                AgentConstants.AnalysisContainerStoreId,
                AgentConstants.AnalysisContainerStoreRetentionPolicy,
                token);

            this.signalWaitingToBeProcessedStoreInstance = storeProvider.CreatePersistentStoreKeyGuidValueStringAsync(
                AgentConstants.AnalysisUnprocessedSignalStoreId,
                AgentConstants.AnalysisUnprocessedSignalStoreRetentionPolicy,
                this.CancelToken).GetAwaiter().GetResult();

            Assert.IsNotNull(this.signalWaitingToBeProcessedStoreInstance, "signalWaitingToBeProcessedStoreInstance");

            // Restore state from any of the previous Runs.
            this.RestoreStateFromPreviousRunsAsync().GetAwaiter().GetResult();

            this.Logger.LogMessage("kicking off Activation Task");
            var activationTask = this.TaskRunner.Run("AgentActivationTask", this.ActivateAnalysisAsync, this.CancelToken);

            this.InitializeDataFlowPipeline();
        }
예제 #5
0
 public HealthQueryHelper(IClusterQuery query, FabricClient fabricClient, ILogProvider logProvider)
 {
     this.logger       = logProvider.CreateLoggerInstance("HealthQuery");
     this.clusterQuery = query;
     this.fabricClient = fabricClient;
 }
 internal PerformanceSessionManager(ILogProvider logProvider, CancellationToken token)
 {
     this.logger            = logProvider.CreateLoggerInstance("PerformanceSessionManager");
     this.sessionLoggerTask = this.CreateSessionLoggerTask(token);
 }
예제 #7
0
 internal ClusterAnalysisRunner(ILogProvider logProvider)
 {
     ReleaseAssert.AssertIfNull(logProvider, "logProvider != null");
     this.logger         = logProvider.CreateLoggerInstance(ClusterAnalyzerRunnerTraceIdentifier);
     this.analysisEngine = new ClusterAnalysisEngine();
 }
예제 #8
0
 protected TraceStoreReader(ILogProvider logProvider)
 {
     Assert.IsNotNull(logProvider, "logProvider != null");
     this.Logger = logProvider.CreateLoggerInstance(this.GetType().Name);
 }