Ejemplo n.º 1
0
        private HealthTracker BuildHealthTracker(BuildContext context)
        {
            var healthSettings = healthSettingsCustomization.Customize(new HealthTrackerSettings());
            var healthTracker  = new HealthTracker(healthSettings.ChecksPeriod, context.Log);

            if (healthSettings.AddDatacenterWhitelistCheck)
            {
                healthTracker.RegisterCheck(WellKnownHealthCheckNames.DatacenterWhitelist, new DatacenterWhitelistCheck(context.Datacenters));
            }

            if (healthSettings.AddThreadPoolStarvationCheck)
            {
                healthTracker.RegisterCheck(WellKnownHealthCheckNames.ThreadPoolStarvation, new ThreadPoolStarvationCheck());
            }

            if (healthSettings.AddZooKeeperConnectionCheck && context.ZooKeeperClient is ZooKeeperClient realClient)
            {
                healthTracker.RegisterCheck(WellKnownHealthCheckNames.ZooKeeperConnection, new ZooKeeperConnectionCheck(realClient));
            }

            if (healthSettings.AddDnsResolutionCheck && RuntimeDetector.IsDotNet50AndNewer)
            {
                healthTracker.RegisterCheck(WellKnownHealthCheckNames.DnsResolution, context.RegisterDisposable(new DnsResolutionCheck()));
            }

            return(healthTracker);
        }
Ejemplo n.º 2
0
        private HealthTracker BuildHealthTracker(BuildContext context)
        {
            var healthSettings = healthSettingsCustomization.Customize(new HealthTrackerSettings());
            var healthTracker  = new HealthTracker(healthSettings.ChecksPeriod, context.Log);

            if (healthSettings.AddDatacenterWhitelistCheck)
            {
                healthTracker.RegisterCheck("Datacenter whitelist", new DatacenterWhitelistCheck(context.Datacenters ?? new EmptyDatacenters()));
            }

            if (healthSettings.AddThreadPoolStarvationCheck)
            {
                healthTracker.RegisterCheck("Thread pool", new ThreadPoolStarvationCheck());
            }

            if (healthSettings.AddZooKeeperConnectionCheck && context.ZooKeeperClient is ZooKeeperClient realClient)
            {
                healthTracker.RegisterCheck("ZooKeeper connection", new ZooKeeperConnectionCheck(realClient));
            }

            return(healthTracker);
        }
Ejemplo n.º 3
0
 public DiagnosticsHub(DiagnosticInfo info, HealthTracker healthTracker)
 {
     Info          = info;
     HealthTracker = healthTracker;
 }