/// <inheritdoc /> public ConsulNodeSourceFactory(ILog log, ConsulClient consulClient, Func <DeploymentIdentifier, ConsulNodeSource> createConsulNodeSource, IDateTime dateTime, Func <ConsulConfig> getConfig, IHealthMonitor healthMonitor) { Log = log; ConsulClient = consulClient; CreateConsulNodeSource = createConsulNodeSource; DateTime = dateTime; GetConfig = getConfig; _serviceListHealthMonitor = healthMonitor.SetHealthFunction("ConsulServiceList", () => new ValueTask <HealthCheckResult>(_healthStatus)); // nest under "Consul" along with other consul-related healths. Task.Run(() => GetAllLoop()); }
public void Setup() { _dateTimeFake = new DateTimeFake(); healthMonitor = Substitute.For <IHealthMonitor>(); healthMonitor.SetHealthFunction(Arg.Any <string>(), Arg.Any <Func <HealthCheckResult> >(), Arg.Any <Func <Dictionary <string, string> > >()) .Returns(c => { _getHealthResult = c.Arg <Func <HealthCheckResult> >(); return(new ComponentHealthMonitor(c.Arg <string>(), _getHealthResult)); }); }
public ConfigCache(IConfigItemsSource source, IConfigurationDataWatcher watcher, ILog log, IHealthMonitor healthMonitor) { Source = source; Log = log; ConfigChangedBroadcastBlock = new BroadcastBlock <ConfigItemsCollection>(null); watcher.DataChanges.LinkTo(new ActionBlock <bool>(nothing => Refresh())); _healthMonitor = healthMonitor; _healthMonitor.SetHealthFunction(nameof(ConfigCache), HealthCheck); Refresh(false).GetAwaiter().GetResult(); }
public ConfigObjectCreator(Type objectType, ConfigCache configCache, UsageTracking usageTracking, ILog log, IHealthMonitor healthMonitor) { UsageTracking = usageTracking; Log = log; ObjectType = objectType; ConfigCache = configCache; ConfigPath = GetConfigPath(); Validator = new DataAnnotationsValidator.DataAnnotationsValidator(); Create(); ConfigCache.ConfigChanged.LinkTo(new ActionBlock <ConfigItemsCollection>(c => Create())); InitializeBroadcast(); healthMonitor.SetHealthFunction($"{ObjectType.Name} Configuration", HealthCheck); }
public LoadBalancer( IDiscovery discovery, DeploymentIdentifier deploymentIdentifier, ReachabilityCheck reachabilityCheck, TrafficRoutingStrategy trafficRoutingStrategy, Func <Node, DeploymentIdentifier, ReachabilityCheck, Action, NodeMonitoringState> createNodeMonitoringState, IHealthMonitor healthMonitor, IDateTime dateTime, ILog log) { DeploymentIdentifier = deploymentIdentifier; Discovery = discovery; ReachabilityCheck = reachabilityCheck; TrafficRoutingStrategy = trafficRoutingStrategy; CreateNodeMonitoringState = createNodeMonitoringState; DateTime = dateTime; Log = log; _healthMonitor = healthMonitor.SetHealthFunction(DeploymentIdentifier.ToString(), () => new ValueTask <HealthCheckResult>(_healthStatus)); }
public AggregatingHealthStatus(string componentName, IHealthMonitor healthMonitor) { healthMonitor.SetHealthFunction(componentName, HealthCheck); }
public PassiveAggregatingHealthCheck(IDateTime dateTime, string componentName, IHealthMonitor healthMonitor, ReportingStrategy reportingStrategy) { _reportingStrategy = reportingStrategy; DateTime = dateTime; healthMonitor.SetHealthFunction(componentName, GetHealthStatusAndCleanup); }