public EventStoreReader() { TraceStoreConnectionInformation connectionInfo = null; if (ClusterSettingsReader.IsOneBoxEnvironment()) { EventStoreLogger.Logger.LogMessage("One Box Environment. Configuring local Reader"); connectionInfo = new LocalTraceStoreConnectionInformation( FabricEnvironment.GetDataRoot(), FabricEnvironment.GetLogRoot(), FabricEnvironment.GetCodePath()); } else { EventStoreLogger.Logger.LogMessage("Cloud Environment. Configuring Cloud Reader"); var operationalConsumer = ClusterSettingsReader.OperationalConsumer; if (operationalConsumer == null) { throw new ConnectionParsingException(ErrorCodes.AzureConnectionInformationMissing, "Config is Missing Operational Store Connection information"); } connectionInfo = new AzureTraceStoreConnectionInformation( operationalConsumer.Connection.AccountName, operationalConsumer.Connection.AccountKey, operationalConsumer.TablesPrefix, null, operationalConsumer.DeploymentId, EventStoreLogProvider.LogProvider); } var connection = new TraceStoreConnection(connectionInfo, EventStoreLogProvider.LogProvider); traceStoreReader = connection.EventStoreReader; }
private async Task <IInsightRuntime> CreateRunTimeAsync(ClusterAnalysisConfiguration configuration, CancellationToken token) { this.logger.LogMessage("CreateRunTimeAsync:: Entering"); IInsightRuntime runtime; var isOneBox = await this.IsCurrentDeploymentOneboxAsync(token).ConfigureAwait(false); if (isOneBox) { var config = this.CreateOneBoxConfig(configuration); this.logger.LogMessage("OneBoxConfig: {0}", config); runtime = DefaultInsightRuntime.GetInstance( ClusterAnalysisLogProvider.LogProvider, PersistentStoreProvider.GetStateProvider(this.stateManager), config, new PerformanceSessionManager(ClusterAnalysisLogProvider.LogProvider, token), new TaskRunner(ClusterAnalysisLogProvider.LogProvider, this.OnUnhandledExceptionInAnalysisAsync), token); this.AddServiceToRuntime(runtime, typeof(FabricClient), this.fabricClient); this.AddServiceToRuntime(runtime, typeof(IClusterQuery), ClusterQuery.CreateClusterQueryInstance(runtime)); this.AddServiceToRuntime(runtime, typeof(IResolveServiceEndpoint), new ResolveServiceEndpoint(ServicePartitionResolver.GetDefault())); var localStoreConnection = new LocalTraceStoreConnectionInformation( runtime.GetCurrentConfig().RuntimeContext.FabricDataRoot, runtime.GetCurrentConfig().RuntimeContext.FabricLogRoot, runtime.GetCurrentConfig().RuntimeContext.FabricCodePath); this.AddServiceToRuntime( runtime, typeof(TraceStoreConnectionInformation), localStoreConnection); } else { this.logger.LogMessage("CreateRunTimeAsync:: Only One-Box deployment supported currently"); throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Cluster Analysis is only supported on One-Box deployment for Preview.")); } return(runtime); }
private async Task InitIfRequiredAsync(CancellationToken token) { if (this.initialized) { return; } await this.singleAccess.WaitAsync(token).ConfigureAwait(false); if (this.initialized) { return; } EventStoreLogger.Logger.LogMessage("Doing Reader Initialization"); try { TraceStoreConnectionInformation connectionInfo = null; if (ClusterSettingsReader.IsOneBoxEnvironment()) { EventStoreLogger.Logger.LogMessage("One Box Environment. Configuring local Reader"); connectionInfo = new LocalTraceStoreConnectionInformation( FabricEnvironment.GetDataRoot(), FabricEnvironment.GetLogRoot(), FabricEnvironment.GetCodePath()); } else { EventStoreLogger.Logger.LogMessage("Cloud Environment. Configuring Cloud Reader. Mode : {0}", this.dataReaderMode); var operationalConsumer = ClusterSettingsReader.OperationalConsumer; if (operationalConsumer == null) { throw new ConnectionParsingException(ErrorCodes.AzureConnectionInformationMissing, "Config is Missing Operational Store Connection information"); } if (this.dataReaderMode == DataReaderMode.CacheMode) { EventStoreLogger.Logger.LogMessage("Caching is Enabled."); this.azureAccessObject = new AzureTableCachedStorageAccess( new CachePolicy(MaxDaysToMaintainCache, MaxItemsToCache, TimeSpan.FromHours(8)), operationalConsumer.Connection.AccountName, HandyUtil.ConvertToUnsecureString(operationalConsumer.Connection.AccountKey), true, operationalConsumer.TablesPrefix, operationalConsumer.DeploymentId); // Kick-off the Cache Update Task. This task is launched in a separate Task // which is monitored by the TaskRunner and therefore doesn't need to be monitored here. var task = ((AzureTableCachedStorageAccess)azureAccessObject).KickOffUpdaterAsync(token); } else { EventStoreLogger.Logger.LogMessage("Caching is Disabled"); this.azureAccessObject = new AccountAndKeyTableStorageAccess( operationalConsumer.Connection.AccountName, HandyUtil.ConvertToUnsecureString(operationalConsumer.Connection.AccountKey), true); } connectionInfo = new AzureTableStoreStorageAccessInformation(azureAccessObject, operationalConsumer.TablesPrefix, operationalConsumer.DeploymentId); } var connection = new TraceStoreConnection(connectionInfo, EventStoreLogProvider.LogProvider); traceStoreReader = connection.EventStoreReader; this.initialized = true; } finally { this.singleAccess.Release(); } }
protected LocalStoreReader(ILogProvider logProvider, LocalTraceStoreConnectionInformation localConnectionInfo) : base(logProvider) { Assert.IsNotNull(localConnectionInfo, "localConnectionInfo can't be null"); this.localConnectionInfo = localConnectionInfo; }
public LocalEventStoreReader(ILogProvider logProvider, LocalTraceStoreConnectionInformation localConnectionInfo) : base( logProvider, localConnectionInfo) { }