public MembershipAgent( MembershipTableManager tableManager, ClusterHealthMonitor clusterHealthMonitor, ILocalSiloDetails localSilo, IFatalErrorHandler fatalErrorHandler, IOptions <ClusterMembershipOptions> options, ILogger <MembershipAgent> log, IAsyncTimerFactory timerFactory) { this.tableManager = tableManager; this.clusterHealthMonitor = clusterHealthMonitor; this.localSilo = localSilo; this.fatalErrorHandler = fatalErrorHandler; this.clusterMembershipOptions = options.Value; this.log = log; this.iAmAliveTimer = timerFactory.Create( this.clusterMembershipOptions.IAmAliveTablePublishTimeout, nameof(UpdateIAmAlive)); }
public ClusterHealthMonitor( ILocalSiloDetails localSiloDetails, MembershipTableManager tableManager, ILogger <ClusterHealthMonitor> log, IOptions <ClusterMembershipOptions> clusterMembershipOptions, IFatalErrorHandler fatalErrorHandler, IServiceProvider serviceProvider, IAsyncTimerFactory timerFactory) { this.localSiloDetails = localSiloDetails; this.tableManager = tableManager; this.log = log; this.fatalErrorHandler = fatalErrorHandler; this.clusterMembershipOptions = clusterMembershipOptions.Value; this.monitorClusterHealthTimer = timerFactory.Create( this.clusterMembershipOptions.ProbeTimeout, nameof(MonitorClusterHealth)); this.createMonitor = silo => ActivatorUtilities.CreateInstance <SiloHealthMonitor>(serviceProvider, silo); }
internal LocalReminderService( Silo silo, IReminderTable reminderTable, TimeSpan initTimeout, ILoggerFactory loggerFactory, IAsyncTimerFactory asyncTimerFactory) : base(SystemTargetGrainId.CreateGrainServiceGrainId(GrainInterfaceUtils.GetGrainClassTypeCode(typeof(IReminderService)), null, silo.SiloAddress), silo, loggerFactory) { localReminders = new Dictionary <ReminderIdentity, LocalReminderData>(); this.reminderTable = reminderTable; this.initTimeout = initTimeout; this.asyncTimerFactory = asyncTimerFactory; localTableSequence = 0; tardinessStat = AverageTimeSpanStatistic.FindOrCreate(StatisticNames.REMINDERS_AVERAGE_TARDINESS_SECONDS); IntValueStatistic.FindOrCreate(StatisticNames.REMINDERS_NUMBER_ACTIVE_REMINDERS, () => localReminders.Count); ticksDeliveredStat = CounterStatistic.FindOrCreate(StatisticNames.REMINDERS_COUNTERS_TICKS_DELIVERED); startedTask = new TaskCompletionSource <bool>(TaskCreationOptions.RunContinuationsAsynchronously); this.logger = loggerFactory.CreateLogger <LocalReminderService>(); this.listRefreshTimer = asyncTimerFactory.Create(Constants.RefreshReminderList, "ReminderService.ReminderListRefresher"); }
public SiloHealthMonitor( SiloAddress siloAddress, Func <SiloHealthMonitor, ProbeResult, Task> onProbeResult, IOptions <ClusterMembershipOptions> clusterMembershipOptions, ILoggerFactory loggerFactory, IRemoteSiloProber remoteSiloProber, IAsyncTimerFactory asyncTimerFactory, ILocalSiloHealthMonitor localSiloHealthMonitor) { SiloAddress = siloAddress; _clusterMembershipOptions = clusterMembershipOptions.Value; _prober = remoteSiloProber; _localSiloHealthMonitor = localSiloHealthMonitor; _log = loggerFactory.CreateLogger <SiloHealthMonitor>(); _pingTimer = asyncTimerFactory.Create( _clusterMembershipOptions.ProbeTimeout, nameof(SiloHealthMonitor)); _onProbeResult = onProbeResult; _elapsedSinceLastSuccessfulResponse = ValueStopwatch.StartNew(); }
public MembershipTableManager( ILocalSiloDetails localSiloDetails, IOptions <ClusterMembershipOptions> clusterMembershipOptions, IMembershipTable membershipTable, IFatalErrorHandler fatalErrorHandler, IMembershipGossiper gossiper, ILogger <MembershipTableManager> log, IAsyncTimerFactory timerFactory) { this.localSiloDetails = localSiloDetails; this.membershipTableProvider = membershipTable; this.fatalErrorHandler = fatalErrorHandler; this.gossiper = gossiper; this.clusterMembershipOptions = clusterMembershipOptions.Value; this.myAddress = this.localSiloDetails.SiloAddress; this.log = log; var backOffMax = StandardExtensions.Max(EXP_BACKOFF_STEP.Multiply(this.clusterMembershipOptions.ExpectedClusterSize), SiloMessageSender.CONNECTION_RETRY_DELAY.Multiply(2)); this.EXP_BACKOFF_CONTENTION_MAX = backOffMax; this.EXP_BACKOFF_ERROR_MAX = backOffMax; this.snapshot = new MembershipTableSnapshot( this.CreateLocalSiloEntry(this.CurrentStatus), MembershipVersion.MinValue, ImmutableDictionary <SiloAddress, MembershipEntry> .Empty); this.updates = new AsyncEnumerable <MembershipTableSnapshot>( (previous, proposed) => proposed.Version > previous.Version, this.snapshot) { OnPublished = update => Interlocked.Exchange(ref this.snapshot, update) }; this.membershipUpdateTimer = timerFactory.Create( this.clusterMembershipOptions.TableRefreshTimeout, nameof(PeriodicallyRefreshMembershipTable)); }
public LocalSiloHealthMonitor( IEnumerable <IHealthCheckParticipant> healthCheckParticipants, MembershipTableManager membershipTableManager, ConnectionManager connectionManager, ClusterHealthMonitor clusterHealthMonitor, ILocalSiloDetails localSiloDetails, ILogger <LocalSiloHealthMonitor> log, IOptions <ClusterMembershipOptions> clusterMembershipOptions, IAsyncTimerFactory timerFactory, ILoggerFactory loggerFactory, ProbeRequestMonitor probeRequestMonitor) { _healthCheckParticipants = healthCheckParticipants.ToList(); _membershipTableManager = membershipTableManager; _clusterHealthMonitor = clusterHealthMonitor; _localSiloDetails = localSiloDetails; _log = log; _probeRequestMonitor = probeRequestMonitor; _clusterMembershipOptions = clusterMembershipOptions.Value; _degradationCheckTimer = timerFactory.Create( _clusterMembershipOptions.LocalHealthDegradationMonitoringPeriod, nameof(LocalSiloHealthMonitor)); _threadPoolMonitor = new ThreadPoolMonitor(loggerFactory.CreateLogger <ThreadPoolMonitor>()); }