public HintsPollerService(String clusterName, ValueStore<Long> timestamp, Session cqlSession, ClusterHintsPoller clusterHintsPoller, MetricRegistry metricRegistry) { _clusterName = checkNotNull(clusterName, "cluster"); _timestamp = checkNotNull(timestamp, "value"); _cqlSession = checkNotNull(cqlSession, "cqlSession"); _clusterHintsPoller = checkNotNull(clusterHintsPoller, "clusterHintsPoller"); ServiceFailureListener.listenTo(this, metricRegistry); }
public HintsPollerService(String clusterName, ValueStore<Long> timestamp, Session cqlSession, ClusterHintsPoller clusterHintsPoller, MetricRegistry metricRegistry) { _clusterName = checkNotNull(clusterName, "cluster"); _timestamp = checkNotNull(timestamp, "value"); _cqlSession = checkNotNull(cqlSession, "cqlSession"); _clusterHintsPoller = checkNotNull(clusterHintsPoller, "clusterHintsPoller"); ServiceFailureListener.listenTo(this, metricRegistry); }
public DedupQueue(String name, String readChannel, String writeChannel, QueueDAO queueDAO, EventStore eventStore, Supplier<Boolean> dedupEnabled, ScheduledExecutorService executor, SortedQueueFactory sortedQueueFactory, MetricRegistry metricRegistry) { _name = checkNotNull(name, "name"); _readChannel = checkNotNull(readChannel, "readChannel"); _writeChannel = checkNotNull(writeChannel, "writeChannel"); _queueDAO = checkNotNull(queueDAO, "queueDAO"); _eventStore = checkNotNull(eventStore, "eventStore"); _dedupEnabled = checkNotNull(dedupEnabled, "dedupEnabled"); _executor = checkNotNull(executor, "executor"); _sortedQueueFactory = sortedQueueFactory; ServiceFailureListener.listenTo(this, metricRegistry); }
public DedupQueue(String name, String readChannel, String writeChannel, QueueDAO queueDAO, EventStore eventStore, Supplier<Boolean> dedupEnabled, ScheduledExecutorService executor, SortedQueueFactory sortedQueueFactory, MetricRegistry metricRegistry) { _name = checkNotNull(name, "name"); _readChannel = checkNotNull(readChannel, "readChannel"); _writeChannel = checkNotNull(writeChannel, "writeChannel"); _queueDAO = checkNotNull(queueDAO, "queueDAO"); _eventStore = checkNotNull(eventStore, "eventStore"); _dedupEnabled = checkNotNull(dedupEnabled, "dedupEnabled"); _executor = checkNotNull(executor, "executor"); _sortedQueueFactory = sortedQueueFactory; ServiceFailureListener.listenTo(this, metricRegistry); }
public SystemQueueMonitor(DatabusEventStore eventStore, DataCenters dataCenters, Collection<ClusterInfo> clusterInfo, int masterFanoutPartitions, int dataCenterFanoutPartitions, MetricRegistry metricRegistry) { _eventStore = checkNotNull(eventStore, "eventStore"); _dataCenters = checkNotNull(dataCenters, "dataCenters"); _clusterInfo = checkNotNull(clusterInfo, "clusterInfo"); _masterFanoutPartitions = masterFanoutPartitions; _dataCenterFanoutPartitions = dataCenterFanoutPartitions; _gauges = new MetricsGroup(metricRegistry); ServiceFailureListener.listenTo(this, metricRegistry); }
public SystemQueueMonitor(DatabusEventStore eventStore, DataCenters dataCenters, Collection<ClusterInfo> clusterInfo, int masterFanoutPartitions, int dataCenterFanoutPartitions, MetricRegistry metricRegistry) { _eventStore = checkNotNull(eventStore, "eventStore"); _dataCenters = checkNotNull(dataCenters, "dataCenters"); _clusterInfo = checkNotNull(clusterInfo, "clusterInfo"); _masterFanoutPartitions = masterFanoutPartitions; _dataCenterFanoutPartitions = dataCenterFanoutPartitions; _gauges = new MetricsGroup(metricRegistry); ServiceFailureListener.listenTo(this, metricRegistry); }
private Optional<LeaderService> startService(final String name) { if (!isOwner(name)) { return Optional.absent(); } _log.info("Starting owned service {}: {}", _group, name); String zkLeaderPath = String.format("/leader/%s/%s", _group.toLowerCase(), name); String threadName = String.format("Leader-%s-%s", _group, name); String taskName = String.format("%s-%s", _group.toLowerCase(), name); LeaderService leaderService = new LeaderService(_curator, zkLeaderPath, _selfId, threadName, 1, TimeUnit.MINUTES, new Supplier<Service>() { @Override public Service get() { return _factory.create(name); } }); ServiceFailureListener.listenTo(leaderService, _metricRegistry); _dropwizardTask.register(taskName, leaderService); leaderService.start(); return Optional.of(leaderService); }
@Override public LeaderService get() { LeaderService service = new LeaderService( curator, "/leader/table-maintenance", self.toString(), "Leader-TableMaintenance-" + scope, 1, TimeUnit.MINUTES, maintenanceServiceFactory); ServiceFailureListener.listenTo(service, metricRegistry); dropwizardTask.register(scope.toLowerCase() + "-maintenance", service); return service; } };
@Override public LeaderService get() { LeaderService service = new LeaderService( curator, "/leader/table-maintenance", self.toString(), "Leader-TableMaintenance-" + scope, 1, TimeUnit.MINUTES, maintenanceServiceFactory); ServiceFailureListener.listenTo(service, metricRegistry); dropwizardTask.register(scope.toLowerCase() + "-maintenance", service); return service; } };
private Optional<LeaderService> startService(final String name) { if (!isOwner(name)) { return Optional.absent(); } _log.info("Starting owned service {}: {}", _group, name); String zkLeaderPath = String.format("/leader/%s/%s", _group.toLowerCase(), name); String threadName = String.format("Leader-%s-%s", _group, name); String taskName = String.format("%s-%s", _group.toLowerCase(), name); LeaderService leaderService = new LeaderService(_curator, zkLeaderPath, _selfId, threadName, 1, TimeUnit.MINUTES, new Supplier<Service>() { @Override public Service get() { return _factory.create(name); } }); ServiceFailureListener.listenTo(leaderService, _metricRegistry); _dropwizardTask.register(taskName, leaderService); leaderService.start(); return Optional.of(leaderService); }
@VisibleForTesting Canary(ClusterInfo cluster, Condition subscriberCondition, Databus databus, RateLimitedLogFactory logFactory, MetricRegistry metricRegistry, @Nullable ScheduledExecutorService executor) { _databus = checkNotNull(databus, "databus"); _timers = new MetricsGroup(metricRegistry); checkNotNull(cluster, "cluster"); _subscriptionName = ChannelNames.getMasterCanarySubscription(cluster.getCluster()); _subscriptionCondition = checkNotNull(subscriberCondition, "subscriptionCondition"); _timerName = newTimerName("readEventsByCanaryPoll-" + cluster.getClusterMetric()); _rateLimitedLog = logFactory.from(_log); _executor = executor; createCanarySubscription(); ServiceFailureListener.listenTo(this, metricRegistry); }
@VisibleForTesting Canary(ClusterInfo cluster, Condition subscriberCondition, Databus databus, RateLimitedLogFactory logFactory, MetricRegistry metricRegistry, @Nullable ScheduledExecutorService executor) { _databus = checkNotNull(databus, "databus"); _timers = new MetricsGroup(metricRegistry); checkNotNull(cluster, "cluster"); _subscriptionName = ChannelNames.getMasterCanarySubscription(cluster.getCluster()); _subscriptionCondition = checkNotNull(subscriberCondition, "subscriptionCondition"); _timerName = newTimerName("readEventsByCanaryPoll-" + cluster.getClusterMetric()); _rateLimitedLog = logFactory.from(_log); _executor = executor; createCanarySubscription(); ServiceFailureListener.listenTo(this, metricRegistry); }
@Inject public MigratorMonitor(@ScannerZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort selfHostAndPort, final ScanWorkflow workflow, final MigratorStatusDAO statusDAO, final DataTools dataTools, LifeCycleRegistry lifecycle, LeaderServiceTask leaderServiceTask, MetricRegistry metricRegistry) { super(curator, LEADER_DIR, selfHostAndPort.toString(), SERVICE_NAME, 1, TimeUnit.MINUTES, new Supplier<Service>() { @Override public Service get() { return new LocalMigratorMonitor(workflow, statusDAO, dataTools); } }); ServiceFailureListener.listenTo(this, metricRegistry); leaderServiceTask.register(SERVICE_NAME, this); lifecycle.manage(new ManagedGuavaService(this)); } }
@Inject public ScanUploadSchedulingService(@ScannerZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort selfHostAndPort, final ScanUploader scanUploader, final List<ScheduledDailyScanUpload> scheduledScans, final ScanCountListener scanCountListener, final StashRequestManager stashRequestManager, LifeCycleRegistry lifecycle, LeaderServiceTask leaderServiceTask, final MetricRegistry metricRegistry, final Clock clock) { super(curator, LEADER_DIR, selfHostAndPort.toString(), SERVICE_NAME, 1, TimeUnit.MINUTES, new Supplier<Service>() { @Override public Service get() { return new DelegateSchedulingService(scanUploader, stashRequestManager, scheduledScans, scanCountListener, clock); } }); ServiceFailureListener.listenTo(this, metricRegistry); leaderServiceTask.register(SERVICE_NAME, this); lifecycle.manage(new ManagedGuavaService(this)); }
@Inject public ScanUploadMonitor(@ScannerZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort selfHostAndPort, final ScanWorkflow scanWorkflow, final ScanStatusDAO scanStatusDAO, final ScanWriterGenerator scanWriterGenerator, final StashStateListener stashStateListener, final ScanCountListener scanCountListener, final DataTools dataTools, LifeCycleRegistry lifecycle, LeaderServiceTask leaderServiceTask, MetricRegistry metricRegistry, @DelegateCompactionControl CompactionControlSource compactionControlSource, DataCenters dataCenters) { super(curator, LEADER_DIR, selfHostAndPort.toString(), SERVICE_NAME, 1, TimeUnit.MINUTES, new Supplier<Service>() { @Override public Service get() { return new LocalScanUploadMonitor(scanWorkflow, scanStatusDAO, scanWriterGenerator, stashStateListener, scanCountListener, dataTools, compactionControlSource, dataCenters); } }); ServiceFailureListener.listenTo(this, metricRegistry); leaderServiceTask.register(SERVICE_NAME, this); lifecycle.manage(new ManagedGuavaService(this)); } }
private Managed create(final String name, final PartitionEventSourceSupplier eventSourceSupplier, @Nullable final PartitionSelector outboundPartitionSelector, final Duration sleepWhenIdle, final int partitions) { final Function<Multimap<String, ByteBuffer>, Void> eventSink = eventsByChannel -> { _eventStore.addAll(eventsByChannel); return null; }; final Supplier<Iterable<OwnedSubscription>> subscriptionsSupplier = _subscriptionDao::getAllSubscriptions; PartitionedLeaderService partitionedLeaderService = new PartitionedLeaderService( _curator, ZKPaths.makePath("/leader/fanout", "partitioned-" + name), _selfId, "PartitionedLeaderSelector-" + name, partitions, 1, 1, TimeUnit.MINUTES, partition -> new DefaultFanout(name, "partition-" + partition, eventSourceSupplier.createEventSourceForPartition(partition), eventSink, outboundPartitionSelector, sleepWhenIdle, subscriptionsSupplier, _dataCenters.getSelf(), _logFactory, _subscriptionEvaluator, _fanoutLagMonitor, _metricRegistry, _clock), _clock); for (LeaderService leaderService : partitionedLeaderService.getPartitionLeaderServices()) { ServiceFailureListener.listenTo(leaderService, _metricRegistry); } _dropwizardTask.register("databus-fanout-" + name, partitionedLeaderService); return partitionedLeaderService; }
private Managed create(final String name, final PartitionEventSourceSupplier eventSourceSupplier, @Nullable final PartitionSelector outboundPartitionSelector, final Duration sleepWhenIdle, final int partitions) { final Function<Multimap<String, ByteBuffer>, Void> eventSink = eventsByChannel -> { _eventStore.addAll(eventsByChannel); return null; }; final Supplier<Iterable<OwnedSubscription>> subscriptionsSupplier = _subscriptionDao::getAllSubscriptions; PartitionedLeaderService partitionedLeaderService = new PartitionedLeaderService( _curator, ZKPaths.makePath("/leader/fanout", "partitioned-" + name), _selfId, "PartitionedLeaderSelector-" + name, partitions, 1, 1, TimeUnit.MINUTES, partition -> new DefaultFanout(name, "partition-" + partition, eventSourceSupplier.createEventSourceForPartition(partition), eventSink, outboundPartitionSelector, sleepWhenIdle, subscriptionsSupplier, _dataCenters.getSelf(), _logFactory, _subscriptionEvaluator, _fanoutLagMonitor, _metricRegistry, _clock), _clock); for (LeaderService leaderService : partitionedLeaderService.getPartitionLeaderServices()) { ServiceFailureListener.listenTo(leaderService, _metricRegistry); } _dropwizardTask.register("databus-fanout-" + name, partitionedLeaderService); return partitionedLeaderService; }
@Inject CompactionControlMonitorManager(LifeCycleRegistry lifeCycle, @LocalCompactionControl CompactionControlSource compactionControlSource, @GlobalFullConsistencyZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort self, Clock clock, LeaderServiceTask dropwizardTask, final MetricRegistry metricRegistry) { LeaderService leaderService = new LeaderService( curator, "/leader/compaction-control-monitor", self.toString(), "Leader-CompactionControlMonitor", 30, TimeUnit.MINUTES, () -> new CompactionControlMonitor(compactionControlSource, clock, metricRegistry) ); ServiceFailureListener.listenTo(leaderService, metricRegistry); dropwizardTask.register("stash-runtime-monitor", leaderService); lifeCycle.manage(new ManagedGuavaService(leaderService)); } }
@Inject SystemQueueMonitorManager(LifeCycleRegistry lifeCycle, final DatabusEventStore eventStore, final DataCenters dataCenters, @DatabusClusterInfo final Collection<ClusterInfo> clusterInfo, @DatabusZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort self, @MasterFanoutPartitions int masterFanoutPartitions, @DataCenterFanoutPartitions int dataCenterFanoutPartitions, LeaderServiceTask dropwizardTask, final MetricRegistry metricRegistry) { LeaderService leaderService = new LeaderService( curator, "/leader/queue-monitor", self.toString(), "Leader-QueueMonitor", 1, TimeUnit.MINUTES, new Supplier<Service>() { @Override public Service get() { return new SystemQueueMonitor(eventStore, dataCenters, clusterInfo, masterFanoutPartitions, dataCenterFanoutPartitions, metricRegistry); } }); ServiceFailureListener.listenTo(leaderService, metricRegistry); dropwizardTask.register("queue-monitor", leaderService); lifeCycle.manage(new ManagedGuavaService(leaderService)); } }
@Inject SystemQueueMonitorManager(LifeCycleRegistry lifeCycle, final DatabusEventStore eventStore, final DataCenters dataCenters, @DatabusClusterInfo final Collection<ClusterInfo> clusterInfo, @DatabusZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort self, @MasterFanoutPartitions int masterFanoutPartitions, @DataCenterFanoutPartitions int dataCenterFanoutPartitions, LeaderServiceTask dropwizardTask, final MetricRegistry metricRegistry) { LeaderService leaderService = new LeaderService( curator, "/leader/queue-monitor", self.toString(), "Leader-QueueMonitor", 1, TimeUnit.MINUTES, new Supplier<Service>() { @Override public Service get() { return new SystemQueueMonitor(eventStore, dataCenters, clusterInfo, masterFanoutPartitions, dataCenterFanoutPartitions, metricRegistry); } }); ServiceFailureListener.listenTo(leaderService, metricRegistry); dropwizardTask.register("queue-monitor", leaderService); lifeCycle.manage(new ManagedGuavaService(leaderService)); } }