protected override void OnStart(string[] args) { Log.Debug("OnStart"); if (HealthChecksSection == null || HealthChecksSection.HealthChecks == null || HealthChecksSection.HealthChecks.Count == 0) { Log.Error(SystemConstants.MISSING_HEALTH_CHECK_SECTION); } try { HealthChecks healthCheckConfigs = HealthChecksSection.GetConfig().HealthChecks; for (int ii = 0; ii < healthCheckConfigs.Count; ii++) { healthChecks.Add(healthCheckConfigs[ii]); } IKernel kernel = new BindKernelwithHealthChecks(new StandardKernel(new ServiceModule()), HealthChecksSection.HealthChecks).Bind(); healthCheckList = new HealthCheckList(healthChecks, kernel); healthCheckList.HealthCheckError += HealthCheckList_HealthCheckError; healthCheckList.SeriousResult += HealthCheckList_SeriousResult; healthCheckList.Start(); } catch (ScheduleProviderException ex) { Log.ErrorFormat($"Failed: {ex.ProviderName}"); Log.Error(ex); OnStop(); } finally { Log.Debug("Finished OnStart"); } }
/// <summary>Snippet for List</summary> public void List() { // Snippet: List(string, CallSettings) // Create client HealthChecksClient healthChecksClient = HealthChecksClient.Create(); // Initialize request argument(s) string project = ""; // Make the request HealthCheckList response = healthChecksClient.List(project); // End snippet }
/// <summary>Snippet for ListAsync</summary> public async Task ListAsync() { // Snippet: ListAsync(string, CallSettings) // Additional: ListAsync(string, CancellationToken) // Create client HealthChecksClient healthChecksClient = await HealthChecksClient.CreateAsync(); // Initialize request argument(s) string project = ""; // Make the request HealthCheckList response = await healthChecksClient.ListAsync(project); // End snippet }
/// <summary>Snippet for List</summary> public void ListRequestObject() { // Snippet: List(ListHealthChecksRequest, CallSettings) // Create client HealthChecksClient healthChecksClient = HealthChecksClient.Create(); // Initialize request argument(s) ListHealthChecksRequest request = new ListHealthChecksRequest { PageToken = "", MaxResults = 0U, Filter = "", OrderBy = "", Project = "", ReturnPartialSuccess = false, }; // Make the request HealthCheckList response = healthChecksClient.List(request); // End snippet }
/// <summary>Snippet for ListAsync</summary> public async Task ListRequestObjectAsync() { // Snippet: ListAsync(ListHealthChecksRequest, CallSettings) // Additional: ListAsync(ListHealthChecksRequest, CancellationToken) // Create client HealthChecksClient healthChecksClient = await HealthChecksClient.CreateAsync(); // Initialize request argument(s) ListHealthChecksRequest request = new ListHealthChecksRequest { PageToken = "", MaxResults = 0U, Filter = "", OrderBy = "", Project = "", ReturnPartialSuccess = false, }; // Make the request HealthCheckList response = await healthChecksClient.ListAsync(request); // End snippet }