public class ClusterMetricsCollector
extends java.lang.Object
implements akka.actor.Actor, akka.actor.ActorLogging
Cluster metrics is primarily for load-balancing of nodes. It controls metrics sampling at a regular frequency, prepares highly variable data for further analysis by other entities, and publishes the latest cluster metrics data around the node ring and local eventStream to assist in determining the need to redirect traffic to the least-loaded nodes.
Metrics sampling is delegated to the MetricsCollector
.
Smoothing of the data for each monitored process is delegated to the
EWMA
for exponential weighted moving average.
Constructor and Description |
---|
ClusterMetricsCollector(akka.actor.ActorRef publisher) |
Modifier and Type | Method and Description |
---|---|
void |
addMember(Member member)
Adds a member to the node ring.
|
Cluster |
cluster() |
void |
collect()
Samples the latest metrics for the node, updates metrics statistics in
MetricsGossip , and publishes the change to the event bus. |
MetricsCollector |
collector()
The metrics collector that samples data on the node.
|
void |
gossip()
Gossip to peer nodes.
|
akka.actor.Cancellable |
gossipTask()
Start periodic gossip to random nodes in cluster
|
void |
gossipTo(akka.actor.Address address) |
MetricsGossip |
latestGossip()
The latest metric values with their statistical data.
|
akka.actor.Cancellable |
metricsTask()
Start periodic metrics collection
|
scala.collection.immutable.SortedSet<akka.actor.Address> |
nodes()
The node ring gossipped that contains only members that are Up.
|
void |
postStop() |
void |
preStart() |
void |
publish()
Publishes to the event stream.
|
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive() |
void |
receiveGossip(MetricsGossipEnvelope envelope)
Receives changes from peer nodes, merges remote with local gossip nodes, then publishes
changes to the event stream for load balancing router consumption, and gossip back.
|
void |
receiveState(ClusterEvent.CurrentClusterState state)
Updates the initial node ring for those nodes that are
MemberStatus Up . |
void |
removeMember(Member member)
Removes a member from the member node ring.
|
void |
replyGossipTo(akka.actor.Address address) |
scala.Option<akka.actor.Address> |
selectRandomNode(scala.collection.immutable.IndexedSeq<akka.actor.Address> addresses) |
void |
sendGossip(akka.actor.Address address,
MetricsGossipEnvelope envelope) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ClusterMetricsCollector(akka.actor.ActorRef publisher)
public Cluster cluster()
public scala.collection.immutable.SortedSet<akka.actor.Address> nodes()
public MetricsGossip latestGossip()
public MetricsCollector collector()
public akka.actor.Cancellable gossipTask()
public akka.actor.Cancellable metricsTask()
public void preStart()
preStart
in interface akka.actor.Actor
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
receive
in interface akka.actor.Actor
public void postStop()
postStop
in interface akka.actor.Actor
public void addMember(Member member)
member
- (undocumented)public void removeMember(Member member)
member
- (undocumented)public void receiveState(ClusterEvent.CurrentClusterState state)
MemberStatus
Up
.state
- (undocumented)public void collect()
MetricsGossip
, and publishes the change to the event bus.
collect()
public void receiveGossip(MetricsGossipEnvelope envelope)
envelope
- (undocumented)public void gossip()
public void gossipTo(akka.actor.Address address)
public void replyGossipTo(akka.actor.Address address)
public void sendGossip(akka.actor.Address address, MetricsGossipEnvelope envelope)
public scala.Option<akka.actor.Address> selectRandomNode(scala.collection.immutable.IndexedSeq<akka.actor.Address> addresses)
public void publish()