public SelfRefreshingClient(string apiKey, ConfigurationOptions config, ISplitLogger log = null) : base(GetLogger(log)) { _config = (SelfRefreshingConfig)_configService.ReadConfig(config, ConfingTypes.InMemory); LabelsEnabled = _config.LabelsEnabled; ApiKey = apiKey; BuildSplitCache(); BuildSegmentCache(); BuildTelemetryStorage(); BuildTelemetrySyncTask(); BuildSdkApiClients(); BuildSplitFetcher(); BuildTreatmentLog(config); BuildImpressionManager(); BuildEventLog(config); BuildEvaluator(); BuildBlockUntilReadyService(); BuildManager(); BuildSyncManager(); _startSessionMs = CurrentTimeHelper.CurrentTimeMillis(); Start(); }
public SelfRefreshingConfig ReadInMemoryConfig(ConfigurationOptions config) { var baseConfig = ReadBaseConfig(config); var selfRefreshingConfig = new SelfRefreshingConfig { Mode = config.Mode, SdkVersion = baseConfig.SdkVersion, SdkMachineName = baseConfig.SdkMachineName, SdkMachineIP = baseConfig.SdkMachineIP, LabelsEnabled = baseConfig.LabelsEnabled, SplitsRefreshRate = config.FeaturesRefreshRate ?? 5, SegmentRefreshRate = config.SegmentsRefreshRate ?? 60, HttpConnectionTimeout = config.ConnectionTimeout ?? 15000, HttpReadTimeout = config.ReadTimeout ?? 15000, RandomizeRefreshRates = config.RandomizeRefreshRates, ConcurrencyLevel = config.SplitsStorageConcurrencyLevel ?? 4, TreatmentLogSize = config.MaxImpressionsLogSize ?? 30000, ImpressionsBulkSize = 5000, EventLogRefreshRate = config.EventsPushRate ?? 60, EventLogSize = config.EventsQueueSize ?? 10000, EventsBulkSize = 500, EventsFirstPushWindow = config.EventsFirstPushWindow ?? 10, NumberOfParalellSegmentTasks = config.NumberOfParalellSegmentTasks ?? 5, StreamingEnabled = config.StreamingEnabled ?? true, AuthRetryBackoffBase = GetMinimunAllowed(config.AuthRetryBackoffBase ?? 1, 1, "AuthRetryBackoffBase"), StreamingReconnectBackoffBase = GetMinimunAllowed(config.StreamingReconnectBackoffBase ?? 1, 1, "StreamingReconnectBackoffBase"), ImpressionsMode = config.ImpressionsMode ?? ImpressionsMode.Optimized, TelemetryRefreshRate = GetMinimunAllowed(config.TelemetryRefreshRate ?? 3600, 60, "TelemetryRefreshRate"), ImpressionListener = config.ImpressionListener, AuthServiceURL = string.IsNullOrEmpty(config.AuthServiceURL) ? Constants.Urls.AuthServiceURL : config.AuthServiceURL, BaseUrl = string.IsNullOrEmpty(config.Endpoint) ? Constants.Urls.BaseUrl : config.Endpoint, EventsBaseUrl = string.IsNullOrEmpty(config.EventsEndpoint) ? Constants.Urls.EventsBaseUrl : config.EventsEndpoint, StreamingServiceURL = string.IsNullOrEmpty(config.StreamingServiceURL) ? Constants.Urls.StreamingServiceURL : config.StreamingServiceURL, TelemetryServiceURL = string.IsNullOrEmpty(config.TelemetryServiceURL) ? Constants.Urls.TelemetryServiceURL : config.TelemetryServiceURL, SdkStartTime = CurrentTimeHelper.CurrentTimeMillis(), OnDemandFetchMaxRetries = 10, OnDemandFetchRetryDelayMs = 50 }; selfRefreshingConfig.TreatmentLogRefreshRate = GetImpressionRefreshRate(selfRefreshingConfig.ImpressionsMode, config.ImpressionsRefreshRate); return(selfRefreshingConfig); }
public SelfRefreshingClient(string apiKey, ConfigurationOptions config, ISplitLogger log = null) : base(GetLogger(log)) { _config = new SelfRefreshingConfig(); Destroyed = false; ApiKey = apiKey; ReadConfig(config); BuildSdkReadinessGates(); BuildSdkApiClients(); BuildSplitFetcher(); BuildTreatmentLog(config); BuildEventLog(config); BuildEvaluator(); BuildBlockUntilReadyService(); BuildManager(); BuildSyncManager(); Start(); }
public TelemetrySyncTask(ITelemetryStorageConsumer telemetryStorage, ITelemetryAPI telemetryAPI, ISplitCache splitCache, ISegmentCache segmentCache, SelfRefreshingConfig configurationOptions, IFactoryInstantiationsService factoryInstantiationsService, IWrapperAdapter wrapperAdapter, ITasksManager tasksManager, ISplitLogger log = null) { _telemetryStorageConsumer = telemetryStorage; _telemetryAPI = telemetryAPI; _splitCache = splitCache; _segmentCache = segmentCache; _configurationOptions = configurationOptions; _factoryInstantiationsService = factoryInstantiationsService; _log = log ?? WrapperAdapter.GetLogger(typeof(TelemetrySyncTask)); _wrapperAdapter = wrapperAdapter; _tasksManager = tasksManager; _cancellationTokenSource = new CancellationTokenSource(); }
public SelfRefreshingClient(string apiKey, ConfigurationOptions config, ISplitLogger log = null) : base(GetLogger(log)) { _config = (SelfRefreshingConfig)_configService.ReadConfig(config, ConfingTypes.InMemory); LabelsEnabled = _config.LabelsEnabled; Destroyed = false; ApiKey = apiKey; BuildSdkReadinessGates(); BuildSdkApiClients(); BuildSplitFetcher(); BuildTreatmentLog(config); BuildImpressionManager(); BuildEventLog(config); BuildEvaluator(); BuildBlockUntilReadyService(); BuildManager(); BuildSyncManager(); Start(); }
public SelfRefreshingConfig ReadInMemoryConfig(ConfigurationOptions config) { var baseConfig = ReadBaseConfig(config); var selfRefreshingConfig = new SelfRefreshingConfig { SdkVersion = baseConfig.SdkVersion, SdkSpecVersion = baseConfig.SdkSpecVersion, SdkMachineName = baseConfig.SdkMachineName, SdkMachineIP = baseConfig.SdkMachineIP, LabelsEnabled = baseConfig.LabelsEnabled, BaseUrl = string.IsNullOrEmpty(config.Endpoint) ? "https://sdk.split.io" : config.Endpoint, EventsBaseUrl = string.IsNullOrEmpty(config.EventsEndpoint) ? "https://events.split.io" : config.EventsEndpoint, SplitsRefreshRate = config.FeaturesRefreshRate ?? 5, SegmentRefreshRate = config.SegmentsRefreshRate ?? 60, HttpConnectionTimeout = config.ConnectionTimeout ?? 15000, HttpReadTimeout = config.ReadTimeout ?? 15000, RandomizeRefreshRates = config.RandomizeRefreshRates, ConcurrencyLevel = config.SplitsStorageConcurrencyLevel ?? 4, TreatmentLogSize = config.MaxImpressionsLogSize ?? 30000, EventLogRefreshRate = config.EventsPushRate ?? 60, EventLogSize = config.EventsQueueSize ?? 5000, EventsFirstPushWindow = config.EventsFirstPushWindow ?? 10, MaxCountCalls = config.MaxMetricsCountCallsBeforeFlush ?? 1000, MaxTimeBetweenCalls = config.MetricsRefreshRate ?? 60, NumberOfParalellSegmentTasks = config.NumberOfParalellSegmentTasks ?? 5, StreamingEnabled = config.StreamingEnabled ?? true, AuthRetryBackoffBase = GetMinimunAllowed(config.AuthRetryBackoffBase ?? 1, 1, "AuthRetryBackoffBase"), StreamingReconnectBackoffBase = GetMinimunAllowed(config.StreamingReconnectBackoffBase ?? 1, 1, "StreamingReconnectBackoffBase"), AuthServiceURL = string.IsNullOrEmpty(config.AuthServiceURL) ? "https://auth.split.io/api/auth" : config.AuthServiceURL, StreamingServiceURL = string.IsNullOrEmpty(config.StreamingServiceURL) ? "https://streaming.split.io/event-stream" : config.StreamingServiceURL, ImpressionsMode = config.ImpressionsMode ?? ImpressionsMode.Optimized }; selfRefreshingConfig.TreatmentLogRefreshRate = GetImpressionRefreshRate(selfRefreshingConfig.ImpressionsMode, config.ImpressionsRefreshRate); return(selfRefreshingConfig); }