public ChangeFeedQueryTimeoutDecorator(IChangeFeedDocumentQuery <Document> query, IHealthMonitor monitor, TimeSpan timeout, ILease lease) { this.query = query; this.monitor = monitor; this.timeout = timeout; this.lease = lease; }
public HealthChecker(IHealthMonitor healthMonitor, ILogger <HealthChecker> logger) { _healthMonitor = healthMonitor; _logger = logger; _healthMonitor.OnNodeStatusUpdated += OnNodeStatusUpdated; _isValid = true; }
public PartitionProcessorFactory( IChangeFeedDocumentClient documentClient, ChangeFeedProcessorOptions changeFeedProcessorOptions, string collectionSelfLink, IHealthMonitor healthMonitor) { if (documentClient == null) { throw new ArgumentNullException(nameof(documentClient)); } if (changeFeedProcessorOptions == null) { throw new ArgumentNullException(nameof(changeFeedProcessorOptions)); } if (collectionSelfLink == null) { throw new ArgumentNullException(nameof(collectionSelfLink)); } if (healthMonitor == null) { throw new ArgumentNullException(nameof(healthMonitor)); } this.documentClient = documentClient; this.changeFeedProcessorOptions = changeFeedProcessorOptions; this.collectionSelfLink = collectionSelfLink; this.healthMonitor = healthMonitor; }
public CosmosDBTriggerListener(ITriggeredFunctionExecutor executor, string functionId, DocumentCollectionInfo documentCollectionLocation, DocumentCollectionInfo leaseCollectionLocation, ChangeFeedProcessorOptions processorOptions, ICosmosDBService monitoredCosmosDBService, ICosmosDBService leasesCosmosDBService, ILogger logger, IRemainingWorkEstimator workEstimator = null) { this._logger = logger; this._executor = executor; this._functionId = functionId; this._hostName = Guid.NewGuid().ToString(); this._monitorCollection = documentCollectionLocation; this._leaseCollection = leaseCollectionLocation; this._processorOptions = processorOptions; this._monitoredCosmosDBService = monitoredCosmosDBService; this._leasesCosmosDBService = leasesCosmosDBService; this._healthMonitor = new CosmosDBTriggerHealthMonitor(this._logger); this._workEstimator = workEstimator; this._scaleMonitorDescriptor = new ScaleMonitorDescriptor($"{_functionId}-CosmosDBTrigger-{_monitorCollection.DatabaseName}-{_monitorCollection.CollectionName}".ToLower()); }
public Endpoint(Guid id, IHealthMonitor monitor, string address, string name, string group) { Id = id; _monitor = monitor; Address = address; Name = name; Group = group; }
/// <summary> /// Sets the <see cref="IHealthMonitor"/> to be used to monitor unhealthiness situation. /// </summary> /// <param name="healthMonitor">The instance of <see cref="IHealthMonitor"/> to use.</param> /// <returns>The instance of <see cref="ChangeFeedProcessorBuilder"/> to use.</returns> public ChangeFeedProcessorBuilder WithHealthMonitor(IHealthMonitor healthMonitor) { if (healthMonitor == null) { throw new ArgumentNullException(nameof(healthMonitor)); } this.healthMonitor = healthMonitor; return(this); }
public MonitorableEndpoint(EndpointIdentity identity, IHealthMonitor monitor) { if (identity == null) throw new ArgumentNullException(nameof(identity)); if (monitor == null) throw new ArgumentNullException(nameof(monitor)); Identity = identity; Monitor = monitor; }
private void InitHealthMonitoring() { var healthMonitor = new HealthMonitor(); this.HealthMonitor = healthMonitor; var healthRequestsHandler = new HealthRequestsHandler(healthMonitor); if (!healthRequestsHandler.AddHandler(this)) { log.WarnFormat("Failed to register health requests handler with path:{0}", HealthRequestsHandler.Path); } }
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 MonitorableEndpoint(EndpointIdentity identity, IHealthMonitor monitor) { if (identity == null) { throw new ArgumentNullException(nameof(identity)); } if (monitor == null) { throw new ArgumentNullException(nameof(monitor)); } Identity = identity; Monitor = monitor; }
public StartupManager( ILogFactory logFactory, IHealthMonitor healthMonitor, IHealthProvider healthProvider, IBlockchainInfoProvider blockchainInfoProvider, IDependenciesInfoProvider dependenciesInfoProvider, ISettingsRenderer settingsRenderer) { _log = logFactory.CreateLog(this); _healthMonitor = healthMonitor; _healthProvider = healthProvider; _blockchainInfoProvider = blockchainInfoProvider; _dependenciesInfoProvider = dependenciesInfoProvider; _settingsRenderer = settingsRenderer; }
public CosmosDBTriggerListener(ITriggeredFunctionExecutor executor, DocumentCollectionInfo documentCollectionLocation, DocumentCollectionInfo leaseCollectionLocation, ChangeFeedProcessorOptions processorOptions, ICosmosDBService monitoredCosmosDBService, ICosmosDBService leasesCosmosDBService, ILogger logger) { this._logger = logger; this._executor = executor; this._hostName = Guid.NewGuid().ToString(); this._monitorCollection = documentCollectionLocation; this._leaseCollection = leaseCollectionLocation; this._processorOptions = processorOptions; this._monitoredCosmosDBService = monitoredCosmosDBService; this._leasesCosmosDBService = leasesCosmosDBService; this._healthMonitor = new CosmosDBTriggerHealthMonitor(this._logger); }
public Service(string name, string executablePath, string[] arguments, string workingDirectory, IReadOnlyDictionary <string, string> environmentVariables, IHealthMonitor healthChecker) { Name = name; Arguments = arguments; EnvironmentVariables = environmentVariables; HealthMonitor = healthChecker; startInfo = new ProcessStartInfo(executablePath) { WorkingDirectory = workingDirectory, Arguments = string.Join(" ", arguments), UseShellExecute = false }; foreach (var envVar in environmentVariables) { startInfo.Environment.Add(envVar); } }
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)); }
private IPartitionManager BuildPartitionManager(ILeaseStoreManager leaseStoreManager) { string feedCollectionSelfLink = this.feedCollectionLocation.GetCollectionSelfLink(); var factory = new CheckpointerObserverFactory(this.observerFactory, this.changeFeedProcessorOptions.CheckpointFrequency); var synchronizer = new PartitionSynchronizer( this.feedDocumentClient, feedCollectionSelfLink, leaseStoreManager, leaseStoreManager, this.changeFeedProcessorOptions.DegreeOfParallelism, this.changeFeedProcessorOptions.QueryPartitionsMaxBatchSize); var bootstrapper = new Bootstrapper(synchronizer, leaseStoreManager, this.lockTime, this.sleepTime); var partitionSuperviserFactory = new PartitionSupervisorFactory( factory, leaseStoreManager, this.partitionProcessorFactory ?? new PartitionProcessorFactory(this.feedDocumentClient, this.changeFeedProcessorOptions, leaseStoreManager, feedCollectionSelfLink), this.changeFeedProcessorOptions); if (this.loadBalancingStrategy == null) { this.loadBalancingStrategy = new EqualPartitionsBalancingStrategy( this.HostName, this.changeFeedProcessorOptions.MinPartitionCount, this.changeFeedProcessorOptions.MaxPartitionCount, this.changeFeedProcessorOptions.LeaseExpirationInterval); } IPartitionController partitionController = new PartitionController(leaseStoreManager, leaseStoreManager, partitionSuperviserFactory, synchronizer); if (this.healthMonitor == null) { this.healthMonitor = new TraceHealthMonitor(); } partitionController = new HealthMonitoringPartitionControllerDecorator(partitionController, this.healthMonitor); var partitionLoadBalancer = new PartitionLoadBalancer( partitionController, leaseStoreManager, this.loadBalancingStrategy, this.changeFeedProcessorOptions.LeaseAcquireInterval); return(new PartitionManager(bootstrapper, partitionController, partitionLoadBalancer)); }
public NetworkResolver(IHealthMonitor healthMonitor) { _healthMonitor = healthMonitor; _healthMonitor.OnNodeStatusUpdated += OnNodeStatusUpdated; }
public PassiveAggregatingHealthCheck(IDateTime dateTime, string componentName, IHealthMonitor healthMonitor, ReportingStrategy reportingStrategy) { _reportingStrategy = reportingStrategy; DateTime = dateTime; healthMonitor.SetHealthFunction(componentName, GetHealthStatusAndCleanup); }
public DoseController(IHealthMonitor healthMonitor, IMedicinePump medicinePump, IAlertService alertService) { }
public AggregatingHealthStatus(string componentName, IHealthMonitor healthMonitor) { healthMonitor.SetHealthFunction(componentName, HealthCheck); }
/// <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 AccountService(string accountServiceUrl, string accountServiceUrlWithCacheRefresh, string accountServiceUserName, string accountServicePassword, string blobServiceUrl, string fallBackBlobServiceUrl, int requestTimeOut, IHealthMonitor healthMonitor) { this.accountServiceUrl = accountServiceUrl; this.accountServiceUrlWithCacheRefresh = accountServiceUrlWithCacheRefresh; this.accountServiceUserName = accountServiceUserName; this.accountServicePassword = accountServicePassword; this.blobServiceUrl = blobServiceUrl; this.fallBackBlobServiceUrl = fallBackBlobServiceUrl; this.requestTimeout = requestTimeOut; this.Timeout = requestTimeOut; if (!string.IsNullOrEmpty(blobServiceUrl)) { this.Timeout += requestTimeOut; } this.blobHttpQueue.QueueTimeout = TimeSpan.FromMilliseconds(2 * this.requestTimeout); this.fallBackBlobHttpQueue.QueueTimeout = TimeSpan.FromMilliseconds(2 * this.requestTimeout); this.accountServiceHttpQueue.QueueTimeout = TimeSpan.FromMilliseconds(2 * this.requestTimeout); this.healthController = new AccountServiceHealthController(this.blobHttpQueue, this.accountServiceHttpQueue); if (healthMonitor != null) { healthMonitor.AddController(this.healthController); } }
public static IAccountService GetAuthenticationHandler(IHealthMonitor healthMonitor) { int timeout = Settings.Default.AccountServiceTimeout; if (timeout <= 0) { log.ErrorFormat("Invalid timeout {0} specified. DefaultAuthentication will be used.", timeout); return(new DefaultAccountService(timeout)); } var accountServiceURL = Settings.Default.AccountServiceUrl; if (string.IsNullOrEmpty(accountServiceURL)) { log.Warn("Authentication handler is not set. DefaultAuthenticaton will be used."); return(new DefaultAccountService(timeout)); } string message; if (AccountService.IsWellFormedUriString(accountServiceURL, out message) == false) { log.ErrorFormat("Invalid AccountService URL specified: message={0}, url={1}. DefaultAuthentication will be used.", message, accountServiceURL); return(new DefaultAccountService(timeout)); } var accountServiceURLWithBlobStorageCacheRefresh = GetAccountServiceUrlWithBlobStorageCacheRefresh(accountServiceURL); if (AccountService.IsWellFormedUriString(accountServiceURL, out message) == false) { log.ErrorFormat("Invalid AccountService URL for BlobStorageCacheRefresh specified: message={0}, url={1}. DefaultAuthentication will be used.", message, accountServiceURLWithBlobStorageCacheRefresh); return(new DefaultAccountService(timeout)); } var blobStorageUrl = Settings.Default.BlobServiceUrl; if (string.IsNullOrEmpty(blobStorageUrl)) { log.InfoFormat("No authentication blob service URL specified."); } else { if (AccountService.IsWellFormedUriString(blobStorageUrl, out message) == false) { log.ErrorFormat("Invalid BlobStorage URL specified: message={0}, URL={1}. BlobService will not be used.", message, blobStorageUrl); blobStorageUrl = null; } else { log.InfoFormat("BlobStorage will be used: URL={0}", blobStorageUrl); } } var fallbackBlobStorageUrl = Settings.Default.FallbackBlobServiceUrl; if (string.IsNullOrEmpty(fallbackBlobStorageUrl)) { log.InfoFormat("No authentication fallback blob service URL specified."); } else { if (AccountService.IsWellFormedUriString(fallbackBlobStorageUrl, out message) == false) { log.ErrorFormat("Invalid Fallback BlobStorage URL specified: message={0}, URL={1}. Fallback BlobService will not be used.", message, fallbackBlobStorageUrl); fallbackBlobStorageUrl = null; } else { log.InfoFormat("FallbackBlobStorage will be used: URL={0}", fallbackBlobStorageUrl); } } if (string.IsNullOrEmpty(Settings.Default.AccountServiceUsername) || string.IsNullOrEmpty(Settings.Default.AccountServicePassword)) { log.ErrorFormat("No AccountService username / password specified"); } log.InfoFormat("Authentication handler is set to {0} with timeout {1}", accountServiceURL, timeout); return(new AccountService(accountServiceURL, accountServiceURLWithBlobStorageCacheRefresh, Settings.Default.AccountServiceUsername, Settings.Default.AccountServicePassword, blobStorageUrl, fallbackBlobStorageUrl, timeout, healthMonitor) { BlobMaxQueuedRequests = Settings.Default.BlobServiceMaxQueuedRequests, BlobMaxConcurentRequests = Settings.Default.BlobServiceMaxConcurrentRequests, BlobMaxErrorRequests = Settings.Default.BlobServiceMaxErrorRequests, BlobMaxTimedOutRequests = Settings.Default.BlobServiceMaxTimedOutRequests, BlobReconnectInterval = Settings.Default.BlobServiceRetryIntervalInSeconds, BlobExpectedErrors = GetIntArrayFromString(Settings.Default.BlobServiceExpectedErrors), AccountServiceMaxQueuedRequests = Settings.Default.AccountServiceMaxQueuedRequests, AccountServiceMaxConcurentRequests = Settings.Default.AccountServiceMaxConcurrentRequests, AccountServiceMaxErrorRequests = Settings.Default.AccountServiceMaxErrorRequests, AccountServiceMaxTimedOutRequests = Settings.Default.AccountServiceMaxTimedOutRequests, AccountServiceReconnectInterval = Settings.Default.AccountServiceRetryIntervalInSeconds, }); }
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 IsAliveController(IHealthMonitor healthMonitor) { _healthMonitor = healthMonitor ?? throw new ArgumentNullException(nameof(healthMonitor)); }
protected void GivenIHaveHealthMonitor() { this.Container.RegisterType<IHealthMonitor, HealthMonitor>(); this.healthMonitor = this.Container.Resolve<IHealthMonitor>(); }
protected void GivenIHaveHealthMonitor() { this.Container.RegisterType <IHealthMonitor, HealthMonitor>(); this.healthMonitor = this.Container.Resolve <IHealthMonitor>(); }
public HealthMonitoringPartitionControllerDecorator(IPartitionController inner, IHealthMonitor monitor) { this.inner = inner ?? throw new ArgumentNullException(nameof(inner)); this.monitor = monitor ?? throw new ArgumentNullException(nameof(monitor)); }