public class ClusterMetricsCollector extends java.lang.Object implements Actor, ActorLogging
Actor responsible for periodic data sampling in the node and publication to the cluster.
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
ClusterMetricsCollector() |
Modifier and Type | Method and Description |
---|---|
void |
addMember(Member member)
Adds a member to the node ring.
|
Cluster |
cluster() |
MetricsCollector |
collector()
The metrics collector that samples data on the node.
|
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
void |
gossip()
Gossip to peer nodes.
|
Cancellable |
gossipTask()
Start periodic gossip to random nodes in cluster
|
void |
gossipTo(Address address) |
MetricsGossip |
latestGossip()
The latest metric values with their statistical data.
|
ClusterMetricsExtension |
metrics() |
scala.collection.immutable.SortedSet<Address> |
nodes()
The node ring gossipped that contains only members that are Up.
|
void |
postStop()
User overridable callback.
|
void |
preStart()
User overridable callback.
|
void |
publish()
Publishes to the event stream.
|
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive()
This defines the initial actor behavior, it must return a partial function
with the actor logic.
|
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(Address address) |
void |
sample()
Samples the latest metrics for the node, updates metrics statistics in
MetricsGossip , and publishes the change to the event bus. |
Cancellable |
sampleTask()
Start periodic metrics collection
|
scala.Option<Address> |
selectRandomNode(scala.collection.immutable.IndexedSeq<Address> addresses) |
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
void |
sendGossip(Address address,
MetricsGossipEnvelope envelope) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, preRestart, sender, supervisorStrategy, unhandled
log
public ActorContext context()
Actor
forward
.
WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API. getContext
returns a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public Cluster cluster()
public ClusterMetricsExtension metrics()
public scala.collection.immutable.SortedSet<Address> nodes()
public MetricsGossip latestGossip()
public MetricsCollector collector()
public Cancellable gossipTask()
public Cancellable sampleTask()
public void preStart()
Actor
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Actor
public void postStop()
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 sample()
MetricsGossip
, and publishes the change to the event bus.
MetricsCollector
public void receiveGossip(MetricsGossipEnvelope envelope)
envelope
- (undocumented)public void gossip()
public void gossipTo(Address address)
public void replyGossipTo(Address address)
public void sendGossip(Address address, MetricsGossipEnvelope envelope)
public scala.Option<Address> selectRandomNode(scala.collection.immutable.IndexedSeq<Address> addresses)
public void publish()