Class GaugeMetric


  • public final class GaugeMetric
    extends MetricValue
    A metric which contains a gauge value, i.e a value which represents the magnitude of something measured at a point in time. This metric value contains some additional information about the distribution of this gauge value in the time interval this metric is for.
    Author:
    Simon Thoresen Hult
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getAverage()
      Returns the average reading of this value in the time interval, or--if no value has been set within this period--the value of 'last' from the most recent interval where this metric was set.
      long getCount()
      Returns the number of assignments of this value in the time interval
      double getLast()
      Returns the most recent assignment of this metric in the time interval, or--if no value has been set within this period--the value of 'last' from the most recent interval where this metric was set.
      double getMax()
      Returns the max value of this metric in the time interval, or--if no value has been set within this period--the value of 'last' from the most recent interval where this metric was set.
      double getMin()
      Returns the min value of this metric in the time interval, or--if no value has been set within this period--the value of 'last' from the most recent interval where this metric was set.
      java.util.Optional<java.util.List<com.yahoo.collections.Tuple2<java.lang.String,​java.lang.Double>>> getPercentiles()
      Returns the 95th percentile value for this time interval
      double getSum()
      Returns the sum of all assignments of this metric in the time interval
      static GaugeMetric newInstance​(double last, double max, double min, double sum, long count)  
      static GaugeMetric newInstance​(double last, double max, double min, double sum, long count, java.util.Optional<java.util.List<com.yahoo.collections.Tuple2<java.lang.String,​java.lang.Double>>> percentiles)  
      static GaugeMetric newSingleValue​(java.lang.Number val)  
      GaugeMetric newWithPreservedLastValue()
      Create a partial clone of this gauge where the value of 'last' is carried over to the new gauge with all other fields left at defaults (0 for count and sum, biggest possible double for min, smallest possible double for max).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getAverage

        public double getAverage()
        Returns the average reading of this value in the time interval, or--if no value has been set within this period--the value of 'last' from the most recent interval where this metric was set.
      • getLast

        public double getLast()
        Returns the most recent assignment of this metric in the time interval, or--if no value has been set within this period--the value of 'last' from the most recent interval where this metric was set.
      • getMax

        public double getMax()
        Returns the max value of this metric in the time interval, or--if no value has been set within this period--the value of 'last' from the most recent interval where this metric was set.
      • getMin

        public double getMin()
        Returns the min value of this metric in the time interval, or--if no value has been set within this period--the value of 'last' from the most recent interval where this metric was set.
      • getSum

        public double getSum()
        Returns the sum of all assignments of this metric in the time interval
      • getCount

        public long getCount()
        Returns the number of assignments of this value in the time interval
      • getPercentiles

        public java.util.Optional<java.util.List<com.yahoo.collections.Tuple2<java.lang.String,​java.lang.Double>>> getPercentiles()
        Returns the 95th percentile value for this time interval
      • newWithPreservedLastValue

        public GaugeMetric newWithPreservedLastValue()
        Create a partial clone of this gauge where the value of 'last' is carried over to the new gauge with all other fields left at defaults (0 for count and sum, biggest possible double for min, smallest possible double for max). Note that since count is 0, these extreme values will never be output from the min/max getters as these will return 'last' in this case.
        Returns:
        A new gauge instance
      • newSingleValue

        public static GaugeMetric newSingleValue​(java.lang.Number val)
      • newInstance

        public static GaugeMetric newInstance​(double last,
                                              double max,
                                              double min,
                                              double sum,
                                              long count)
      • newInstance

        public static GaugeMetric newInstance​(double last,
                                              double max,
                                              double min,
                                              double sum,
                                              long count,
                                              java.util.Optional<java.util.List<com.yahoo.collections.Tuple2<java.lang.String,​java.lang.Double>>> percentiles)