akka.cluster
Class Metric

java.lang.Object
  extended by akka.cluster.Metric
All Implemented Interfaces:
MetricNumericConverter, java.io.Serializable, scala.Equals, scala.Product

public class Metric
extends java.lang.Object
implements MetricNumericConverter, scala.Product, scala.Serializable

Metrics key/value.

Equality of Metric is based on its name.

param: name the metric name param: value the metric value, which must be a valid numerical value, a valid value is neither negative nor NaN/Infinite. param: average the data stream of the metric value, for trending over time. Metrics that are already averages (e.g. system load average) or finite (e.g. as number of processors), are not trended.

See Also:
Serialized Form

Constructor Summary
Metric(java.lang.String name, java.lang.Number value, scala.Option<EWMA> average)
           
 
Method Summary
 scala.Option<EWMA> average()
           
static scala.Option<Metric> create(java.lang.String name, java.lang.Number value, scala.Option<java.lang.Object> decayFactor)
          Creates a new Metric instance if the value is valid, otherwise None is returned.
static scala.Option<Metric> create(java.lang.String name, scala.util.Try<java.lang.Number> value, scala.Option<java.lang.Object> decayFactor)
          Creates a new Metric instance if the Try is successful and the value is valid, otherwise None is returned.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isSmooth()
           
 java.lang.String name()
           
 boolean sameAs(Metric that)
          Returns true if that is tracking the same metric as this.
 double smoothValue()
          The numerical value of the average, if defined, otherwise the latest value
 java.lang.Number value()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface akka.cluster.MetricNumericConverter
convertNumber, defined
 
Methods inherited from interface scala.Product
productArity, productElement, productIterator, productPrefix
 
Methods inherited from interface scala.Equals
canEqual
 

Constructor Detail

Metric

public Metric(java.lang.String name,
              java.lang.Number value,
              scala.Option<EWMA> average)
Method Detail

create

public static scala.Option<Metric> create(java.lang.String name,
                                          java.lang.Number value,
                                          scala.Option<java.lang.Object> decayFactor)
Creates a new Metric instance if the value is valid, otherwise None is returned. Invalid numeric values are negative and NaN/Infinite.

Parameters:
name - (undocumented)
value - (undocumented)
decayFactor - (undocumented)
Returns:
(undocumented)

create

public static scala.Option<Metric> create(java.lang.String name,
                                          scala.util.Try<java.lang.Number> value,
                                          scala.Option<java.lang.Object> decayFactor)
Creates a new Metric instance if the Try is successful and the value is valid, otherwise None is returned. Invalid numeric values are negative and NaN/Infinite.

Parameters:
name - (undocumented)
value - (undocumented)
decayFactor - (undocumented)
Returns:
(undocumented)

name

public java.lang.String name()

value

public java.lang.Number value()

average

public scala.Option<EWMA> average()

smoothValue

public double smoothValue()
The numerical value of the average, if defined, otherwise the latest value

Returns:
(undocumented)

isSmooth

public boolean isSmooth()
Returns:
true if this value is smoothed

sameAs

public boolean sameAs(Metric that)
Returns true if that is tracking the same metric as this.

Parameters:
that - (undocumented)
Returns:
(undocumented)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface scala.Equals
Overrides:
equals in class java.lang.Object