K - public abstract class ClusterMonitor<K extends TurbineData> extends TurbineDataMonitor<K>
TurbineDataMonitor for a cluster of Instances.
The ClusterMonitor exhibits functionality that can be used for any extending class to manage it's respective InstanceMonitors
as Instances go up and down in a dynamic environment and ensure that they receive data from the most up to date set of hosts.
This includes
MonitorConsole to help keep InstanceMonitor start idempotent
| Modifier and Type | Class and Description |
|---|---|
class |
ClusterMonitor.ClusterMonitorInstanceManager
Helper class that responds to hostup and hostdown events and thus can start / stop InstanceMonitors
|
static class |
ClusterMonitor.UnitTest |
| Modifier and Type | Field and Description |
|---|---|
protected MonitorConsole<K> |
clusterConsole |
protected TurbineDataDispatcher<K> |
clusterDispatcher |
protected MonitorConsole<DataFromSingleInstance> |
hostConsole |
protected TurbineDataDispatcher<DataFromSingleInstance> |
hostDispatcher |
protected InstanceObservable |
instanceObservable |
protected InstanceObservable.InstanceObserver |
monitorManager |
protected java.lang.String |
name |
protected Instance |
statsInstance |
protected boolean |
stopped |
protected InstanceUrlClosure |
urlClosure |
| Modifier | Constructor and Description |
|---|---|
|
ClusterMonitor(java.lang.String name,
TurbineDataDispatcher<K> clusterDispatcher,
MonitorConsole<K> clusterConsole,
TurbineDataDispatcher<DataFromSingleInstance> hostDispatcher,
MonitorConsole<DataFromSingleInstance> hostConsole,
InstanceUrlClosure urlClosure) |
protected |
ClusterMonitor(java.lang.String name,
TurbineDataDispatcher<K> cDispatcher,
MonitorConsole<K> cConsole,
TurbineDataDispatcher<DataFromSingleInstance> hDispatcher,
MonitorConsole<DataFromSingleInstance> hConsole,
InstanceUrlClosure urlClosure,
InstanceObservable instanceObservable) |
| Modifier and Type | Method and Description |
|---|---|
TurbineDataDispatcher<K> |
getDispatcher() |
abstract TurbineDataHandler<DataFromSingleInstance> |
getEventHandler()
To be implemented by extending cluster monitors such as the aggregator.
|
int |
getHostCount() |
MonitorConsole<DataFromSingleInstance> |
getInstanceMonitors() |
protected MetaInformation<K> |
getMetaInformation()
Track meta info for this cluster.
|
java.lang.String |
getName() |
abstract ObservationCriteria |
getObservationCriteria() |
Instance |
getStatsInstance() |
boolean |
isRunning() |
void |
registerListenertoClusterMonitor(TurbineDataHandler<K> eventHandler)
Helper method that registers a listener to this cluster monitor.
|
void |
startMonitor()
Start the monitor and register with the InstanceObservable to get updates on host status
|
void |
stopMonitor()
Stop the monitor, shut down resources that were created and notify listeners downstream about the event.
|
getEventDiscarded, getEventProcessed, getLastEventUpdateTime, getRolling2MinuteStats, markEventDiscarded, markEventProcessedprotected final java.lang.String name
protected final TurbineDataDispatcher<K extends TurbineData> clusterDispatcher
protected final MonitorConsole<K extends TurbineData> clusterConsole
protected final TurbineDataDispatcher<DataFromSingleInstance> hostDispatcher
protected final MonitorConsole<DataFromSingleInstance> hostConsole
protected volatile boolean stopped
protected final Instance statsInstance
protected final InstanceObservable instanceObservable
protected final InstanceUrlClosure urlClosure
protected final InstanceObservable.InstanceObserver monitorManager
public ClusterMonitor(java.lang.String name,
TurbineDataDispatcher<K> clusterDispatcher,
MonitorConsole<K> clusterConsole,
TurbineDataDispatcher<DataFromSingleInstance> hostDispatcher,
MonitorConsole<DataFromSingleInstance> hostConsole,
InstanceUrlClosure urlClosure)
name - clusterDispatcher - : the dispatcher to dispatch cluster events to - e.g aggregated eventsclusterConsole - : the console to register itself with, so that it can be discoverd by other listeners to cluster datahostDispatcher - : the dispatcher to receive host events fromhostConsole - : the host console to maintain host connections in.urlClosure - : the config dictating how to connect to a host.protected ClusterMonitor(java.lang.String name,
TurbineDataDispatcher<K> cDispatcher,
MonitorConsole<K> cConsole,
TurbineDataDispatcher<DataFromSingleInstance> hDispatcher,
MonitorConsole<DataFromSingleInstance> hConsole,
InstanceUrlClosure urlClosure,
InstanceObservable instanceObservable)
public java.lang.String getName()
getName in class TurbineDataMonitor<K extends TurbineData>public Instance getStatsInstance()
getStatsInstance in class TurbineDataMonitor<K extends TurbineData>Instancepublic void startMonitor()
throws java.lang.Exception
startMonitor in class TurbineDataMonitor<K extends TurbineData>java.lang.Exceptionpublic void stopMonitor()
stopMonitor in class TurbineDataMonitor<K extends TurbineData>public MonitorConsole<DataFromSingleInstance> getInstanceMonitors()
MonitorConsole<DataFromSingleInstance>@Monitor(name="hostCount",
type=GAUGE)
public int getHostCount()
public boolean isRunning()
public TurbineDataDispatcher<K> getDispatcher()
getDispatcher in class TurbineDataMonitor<K extends TurbineData>TurbineDataDispatcherpublic abstract TurbineDataHandler<DataFromSingleInstance> getEventHandler()
TurbineDataHandler<DataFromSingleInstance>public abstract ObservationCriteria getObservationCriteria()
ObservationCriteriapublic void registerListenertoClusterMonitor(TurbineDataHandler<K> eventHandler)
eventHandler - protected MetaInformation<K> getMetaInformation()