Class Metric

  • All Implemented Interfaces:
    MetricNumericConverter, java.io.Serializable, scala.Equals, scala.Product

    public final class Metric
    extends java.lang.Object
    implements MetricNumericConverter, scala.Product, java.io.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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Metric $colon$plus​(Metric latest)
      Updates the data point, and if defined, updates the data stream (average).
      static Metric apply​(java.lang.String name, java.lang.Number value, scala.Option<EWMA> average)  
      scala.Option<EWMA> average()  
      boolean canEqual​(java.lang.Object x$1)  
      static scala.util.Either<java.lang.Object,​java.lang.Object> convertNumber​(java.lang.Object from)  
      Metric copy​(java.lang.String name, java.lang.Number value, scala.Option<EWMA> average)  
      java.lang.String copy$default$1()  
      java.lang.Number copy$default$2()  
      scala.Option<EWMA> copy$default$3()  
      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.
      static scala.Option<EWMA> createEWMA​(double value, scala.Option<java.lang.Object> decayFactor)  
      static boolean defined​(java.lang.Number value)  
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      boolean isSmooth()  
      java.lang.String name()  
      int productArity()  
      java.lang.Object productElement​(int x$1)  
      java.lang.String productElementName​(int x$1)  
      scala.collection.Iterator<java.lang.Object> productIterator()  
      java.lang.String productPrefix()  
      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.String toString()  
      static scala.Option<scala.Tuple3<java.lang.String,​java.lang.Number,​scala.Option<EWMA>>> unapply​(Metric x$0)  
      java.lang.Number value()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface scala.Product

        productElementNames
    • 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.
      • 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.
      • createEWMA

        public static scala.Option<EWMA> createEWMA​(double value,
                                                    scala.Option<java.lang.Object> decayFactor)
      • apply

        public static Metric apply​(java.lang.String name,
                                   java.lang.Number value,
                                   scala.Option<EWMA> average)
      • unapply

        public static scala.Option<scala.Tuple3<java.lang.String,​java.lang.Number,​scala.Option<EWMA>>> unapply​(Metric x$0)
      • defined

        public static boolean defined​(java.lang.Number value)
      • convertNumber

        public static scala.util.Either<java.lang.Object,​java.lang.Object> convertNumber​(java.lang.Object from)
      • name

        public java.lang.String name()
      • value

        public java.lang.Number value()
      • average

        public scala.Option<EWMA> average()
      • $colon$plus

        public Metric $colon$plus​(Metric latest)
        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

        public boolean sameAs​(Metric that)
        Returns true if that is tracking the same metric as this.
      • 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
      • copy

        public Metric copy​(java.lang.String name,
                           java.lang.Number value,
                           scala.Option<EWMA> average)
      • copy$default$1

        public java.lang.String copy$default$1()
      • copy$default$2

        public java.lang.Number copy$default$2()
      • copy$default$3

        public scala.Option<EWMA> copy$default$3()
      • productPrefix

        public java.lang.String productPrefix()
        Specified by:
        productPrefix in interface scala.Product
      • productArity

        public int productArity()
        Specified by:
        productArity in interface scala.Product
      • productElement

        public java.lang.Object productElement​(int x$1)
        Specified by:
        productElement in interface scala.Product
      • productIterator

        public scala.collection.Iterator<java.lang.Object> productIterator()
        Specified by:
        productIterator in interface scala.Product
      • canEqual

        public boolean canEqual​(java.lang.Object x$1)
        Specified by:
        canEqual in interface scala.Equals
      • productElementName

        public java.lang.String productElementName​(int x$1)
        Specified by:
        productElementName in interface scala.Product
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object