Make akka.cluster.MetricsCollector public, see #3452

This commit is contained in:
Patrik Nordwall 2013-06-18 15:07:26 +02:00
parent 981bce5dd0
commit 8c2859ad03
2 changed files with 8 additions and 6 deletions

View file

@ -154,7 +154,7 @@ akka {
enabled = on enabled = on
# FQCN of the metrics collector implementation. # FQCN of the metrics collector implementation.
# It must implement akka.cluster.cluster.MetricsCollector and # It must implement akka.cluster.MetricsCollector and
# have public constructor with akka.actor.ActorSystem parameter. # have public constructor with akka.actor.ActorSystem parameter.
# The default SigarMetricsCollector uses JMX and Hyperic SIGAR, if SIGAR # The default SigarMetricsCollector uses JMX and Hyperic SIGAR, if SIGAR
# is on the classpath, otherwise only JMX. # is on the classpath, otherwise only JMX.

View file

@ -129,7 +129,7 @@ private[cluster] class ClusterMetricsCollector(publisher: ActorRef) extends Acto
* @see [[akka.cluster.ClusterMetricsCollector.collect( )]] * @see [[akka.cluster.ClusterMetricsCollector.collect( )]]
*/ */
def collect(): Unit = { def collect(): Unit = {
latestGossip :+= collector.sample latestGossip :+= collector.sample()
publish() publish()
} }
@ -575,13 +575,15 @@ private[cluster] trait MetricNumericConverter {
} }
/** /**
* INTERNAL API * Implementations of cluster system metrics extends this trait.
*/ */
private[cluster] trait MetricsCollector extends Closeable { trait MetricsCollector extends Closeable {
/** /**
* Samples and collects new data points. * Samples and collects new data points.
* This method is invoked periodically and should return
* current metrics for this node.
*/ */
def sample: NodeMetrics def sample(): NodeMetrics
} }
/** /**
@ -612,7 +614,7 @@ class JmxMetricsCollector(address: Address, decayFactor: Double) extends Metrics
* Samples and collects new data points. * Samples and collects new data points.
* Creates a new instance each time. * Creates a new instance each time.
*/ */
def sample: NodeMetrics = NodeMetrics(address, newTimestamp, metrics) def sample(): NodeMetrics = NodeMetrics(address, newTimestamp, metrics)
def metrics: Set[Metric] = { def metrics: Set[Metric] = {
val heap = heapMemoryUsage val heap = heapMemoryUsage