Exemplo n.º 1
0
        protected override async Task RunAsync(CancellationToken cancellationToken)
        {
            // Create the operations classes.
            // this._telemetry = new AiTelemetry(this.GetConfigValueAsString(WatchdogConfigSectionName, "AIKey"));
            this._healthCheckOperations = new HealthCheckOperations(
                this,
                this._logger,
                this.GetConfigValueAsTimeSpan(WatchdogConfigSectionName, "HealthCheckInterval", TimeSpan.FromMinutes(5)),
                cancellationToken);

            this._metricsOperations = new MetricsOperations(
                this,
                // this._telemetry,
                this.GetConfigValueAsTimeSpan(WatchdogConfigSectionName, "MetricInterval", TimeSpan.FromMinutes(5)),
                cancellationToken);

            this._cleanupOperations = new CleanupOperations(TimeSpan.FromMinutes(2), cancellationToken)
            {
                Endpoint      = this.GetConfigValueAsString(WatchdogConfigSectionName, "DiagnosticEndpoint"),
                SasToken      = this.GetConfigValueAsString(WatchdogConfigSectionName, "DiagnosticSasToken"),
                TimeToKeep    = this.GetConfigValueAsTimeSpan(WatchdogConfigSectionName, "DiagnosticTimeToKeep", TimeSpan.FromDays(10)),
                TimerInterval = this.GetConfigValueAsTimeSpan(WatchdogConfigSectionName, "DiagnosticInterval", TimeSpan.FromMinutes(2))
            };

            // Register the watchdog health check.
            //await this.RegisterHealthCheckAsync(cancellationToken).ConfigureAwait(false);

            // Loop waiting for cancellation.
            while (false == cancellationToken.IsCancellationRequested)
            {
                // Report the health and metrics of the watchdog to Service Fabric.
                this.ReportWatchdogHealth();
                //await this.ReportWatchdogMetricsAsync(cancellationToken);
                //await this.ReportClusterHealthAsync(cancellationToken);

                // Delay up to the time for the next health report.
                await Task.Delay(this.HealthReportInterval, cancellationToken);
            }

            await base.RunAsync(cancellationToken);
        }
 /// <summary>
 /// HealthCheckController constructor.
 /// </summary>
 /// <param name="service">WatchdogService class instance.</param>
 internal HealthCheckController(WatchdogService service)
 {
     this._operations = service.HealthCheckOperations;
 }
Exemplo n.º 3
0
 /// <summary>
 /// HealthCheckController constructor.
 /// </summary>
 /// <param name="service">WatchdogService class instance.</param>
 public HealthCheckController(WatchdogService service)
 {
     this._operations = service.HealthCheckOperations;
     this._service    = service;
 }