public AutoScaler(ILoadWatcher loadWatcher) { _loadWatcher = loadWatcher; LoadIntegerParameter("MaxThreshold", 4, out _maxThreshold); LoadIntegerParameter("MinThreshold", 2, out _minThreshold); LoadIntegerParameter("MaxScale", 5, out _maxScale); LoadIntegerParameter("MinScale", 2, out _minScale); LoadIntegerParameter("ScaleOutBy", 1, out _scaleOutBy); LoadIntegerParameter("ScaleInBy", 1, out _scaleInBy); _clientId = ConfigurationManager.AppSettings["ClientId"]; _clientSecret = ConfigurationManager.AppSettings["ClientSecret"]; _tenantId = ConfigurationManager.AppSettings["TenantId"]; _azureArmApiBaseUrl = ConfigurationManager.AppSettings["AzureArmApiBaseUrl"]; _subscriptionId = ConfigurationManager.AppSettings["SubscriptionId"]; _resourceGroup = ConfigurationManager.AppSettings["ResourceGroup"]; _vmssName = ConfigurationManager.AppSettings["VmssName"]; _vmssApiVersion = ConfigurationManager.AppSettings["VmssApiVersion"]; _applictionInsightsInstrumentationKey = ConfigurationManager.AppSettings["ApplictionInsightsInstrumentationKey"]; if (!string.IsNullOrEmpty(_applictionInsightsInstrumentationKey)) { _applicationInsightsLoadWacherMetricName = ConfigurationManager.AppSettings["ApplicationInsightsLoadWacherMetricName"]; _telemetry = new TelemetryClient(); _telemetry.InstrumentationKey = _applictionInsightsInstrumentationKey; } }
public AutoScaler(ILoadWatcher loadWatcher) { _loadWatcher = loadWatcher; if (!int.TryParse(ConfigurationManager.AppSettings["MaxThreshold"], out _maxThreshold)) { _maxThreshold = 4; OnTraceEvent($"MaxThreshold Environment Variable is missing, setting MaxThreshold to {_maxThreshold}"); } if (!int.TryParse(ConfigurationManager.AppSettings["MinThreshold"], out _minThreshold)) { _minThreshold = 2; OnTraceEvent($"MinThreshold Environment Variable is missing, setting MinThreshold to {_minThreshold}"); } if (!int.TryParse(ConfigurationManager.AppSettings["MaxScale"], out _maxScale)) { _maxScale = 5; OnTraceEvent($"MaxThreshold Environment Variable is missing, setting MaxThreshold to {_maxScale}"); } if (!int.TryParse(ConfigurationManager.AppSettings["MinScale"], out _minScale)) { _minScale = 2; OnTraceEvent($"MinThreshold Environment Variable is missing, setting MinThreshold to {_minScale}"); } if (!int.TryParse(ConfigurationManager.AppSettings["ScaleUpBy"], out _ScaleUpBy)) { _ScaleUpBy = 1; OnTraceEvent($"_ScaleUpBy Environment Variable is missing, setting _ScaleUpBy to {_ScaleUpBy}"); } if (!int.TryParse(ConfigurationManager.AppSettings["ScaleDownBy"], out _ScaleDownBy)) { _ScaleDownBy = 1; OnTraceEvent($"_ScaleDownBy Environment Variable is missing, setting _ScaleUpBy to {_ScaleDownBy}"); } _clientId = ConfigurationManager.AppSettings["ClientId"]; _clientSecret = ConfigurationManager.AppSettings["ClientSecret"]; _tenantId = ConfigurationManager.AppSettings["TenantId"]; _azureArmApiBaseUrl = ConfigurationManager.AppSettings["AzureArmApiBaseUrl"]; _subscriptionId = ConfigurationManager.AppSettings["SubscriptionId"]; _resourceGroup = ConfigurationManager.AppSettings["ResourceGroup"]; _vmssName = ConfigurationManager.AppSettings["VmssName"]; _vmssApiVersion = ConfigurationManager.AppSettings["VmssApiVersion"]; }
public void SetLoadWatcher(ILoadWatcher loadWatcher) { _loadWatcher = loadWatcher; }