protected override Dictionary <string, string> HealthzDetails() { Dictionary <string, string> healthz = new Dictionary <string, string>() { { "self", "ok" } }; try { using (SqlCommand readDatabases = new SqlCommand("SELECT name FROM master..sysdatabases", this.connection)) { using (SqlDataReader reader = readDatabases.ExecuteReader()) { reader.Read(); } } } catch (Exception ex) { Logger.Error(Strings.ErrorGettingDBListErrorMessage, ex.ToString()); healthz["self"] = "fail"; return(healthz); } try { foreach (ProvisionedService instance in ProvisionedService.GetInstances()) { healthz[instance.Name] = this.GetInstanceHealthz(instance); } } catch (Exception ex) { Logger.Error(Strings.ErrorGettingInstanceListErrorMessage, ex.ToString()); healthz["self"] = "fail"; } return(healthz); }
/// <summary> /// Starts the node. /// </summary> /// <param name="options">The configuration options for the node.</param> /// <param name="sqlOptions">The MS SQL Server options.</param> public void Start(Options options, MSSqlOptions sqlOptions) { if (options == null) { throw new ArgumentNullException("options"); } if (sqlOptions == null) { throw new ArgumentNullException("sqlOptions"); } this.mssqlConfig = sqlOptions; this.maxDbSize = options.MaxDBSize * 1024 * 1024; this.maxLongQuery = options.MaxLengthyQuery; this.maxLongTx = options.MaxLengthTX; this.localIp = NetworkInterface.GetLocalIPAddress(options.LocalRoute); this.connection = this.ConnectMSSql(); TimerHelper.RecurringCall( KeepAliveInterval, delegate { this.KeepAliveMSSql(); }); if (this.maxLongQuery > 0) { TimerHelper.RecurringCall( this.maxLongQuery / 2, delegate { this.KillLongTransactions(); }); } if (this.maxLongTx > 0) { TimerHelper.RecurringCall( this.maxLongTx / 2, delegate { this.KillLongQueries(); }); } else { Logger.Info(Strings.LongTXKillerDisabledInfoMessage); } TimerHelper.RecurringCall( StorageQuotaInterval, delegate { this.EnforceStorageQuota(); }); this.baseDir = options.BaseDir; if (!string.IsNullOrEmpty(this.baseDir)) { Directory.CreateDirectory(this.baseDir); } ProvisionedService.Initialize(options.LocalDB); this.CheckDBConsistency(); this.availableStorageBytes = options.AvailableStorage * 1024 * 1024; this.availableCapacity = options.Capacity; foreach (ProvisionedService provisioned_service in ProvisionedService.GetInstances()) { this.availableStorageBytes -= this.StorageForService(provisioned_service); this.availableCapacity -= this.CapacityUnit(); } this.queriesServed = 0; this.qpsLastUpdated = DateTime.Now; // initialize qps counter this.GetQPS(); this.longQueriesKilled = 0; this.longTxKilled = 0; this.provisionServed = 0; this.bindingServed = 0; this.Start(options); }