Package org.apache.pekko.cluster.metrics
Class Metric
java.lang.Object
org.apache.pekko.cluster.metrics.Metric
- All Implemented Interfaces:
Serializable,MetricNumericConverter,scala.Equals,scala.Product
public final class Metric
extends Object
implements MetricNumericConverter, scala.Product, 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:
-
Method Summary
Modifier and TypeMethodDescription$colon$plus(Metric latest) Updates the data point, and if defined, updates the data stream (average).static Metricscala.Option<EWMA>average()booleanconvertNumber(Object from) scala.Option<EWMA>static scala.Option<Metric>Creates a new Metric instance if the value is valid, otherwise None is returned.static scala.Option<Metric>Creates a new Metric instance if the Try is successful and the value is valid, otherwise None is returned.static scala.Option<EWMA>createEWMA(double value, scala.Option<Object> decayFactor) static booleanbooleaninthashCode()booleanisSmooth()name()intproductElement(int x$1) productElementName(int x$1) scala.collection.Iterator<Object>booleanReturns true ifthatis tracking the same metric as this.doubleThe numerical value of the average, if defined, otherwise the latest valuetoString()value()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pekko.cluster.metrics.MetricNumericConverter
convertNumber, definedMethods inherited from interface scala.Product
productElementNames
-
Method Details
-
create
public static scala.Option<Metric> create(String name, Number value, scala.Option<Object> decayFactor) Creates a new Metric instance if the value is valid, otherwise None is returned. Invalid numeric values are negative and NaN/Infinite. -
create
public static scala.Option<Metric> create(String name, scala.util.Try<Number> value, scala.Option<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. -
createEWMA
-
apply
-
unapply
-
defined
-
convertNumber
-
name
-
value
-
average
-
$colon$plus
Updates the data point, and if defined, updates the data stream (average). Returns the updated metric. -
smoothValue
public double smoothValue()The numerical value of the average, if defined, otherwise the latest value -
isSmooth
public boolean isSmooth()- Returns:
- true if this value is smoothed
-
sameAs
Returns true ifthatis tracking the same metric as this. -
hashCode
public int hashCode() -
equals
-
copy
-
copy$default$1
-
copy$default$2
-
copy$default$3
-
productPrefix
- Specified by:
productPrefixin interfacescala.Product
-
productArity
public int productArity()- Specified by:
productArityin interfacescala.Product
-
productElement
- Specified by:
productElementin interfacescala.Product
-
productIterator
- Specified by:
productIteratorin interfacescala.Product
-
canEqual
- Specified by:
canEqualin interfacescala.Equals
-
productElementName
- Specified by:
productElementNamein interfacescala.Product
-
toString
-