java.lang.Object
org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric

@Public @Unstable public class TimelineMetric extends Object
This class contains the information of a metric that is related to some entity. Metric can either be a time series or single value.
  • Constructor Details

    • TimelineMetric

      public TimelineMetric()
    • TimelineMetric

      public TimelineMetric(TimelineMetric.Type type)
  • Method Details

    • getType

      public TimelineMetric.Type getType()
    • setType

      public void setType(TimelineMetric.Type metricType)
    • getId

      public String getId()
    • setId

      public void setId(String metricId)
    • getRealtimeAggregationOp

      public TimelineMetricOperation getRealtimeAggregationOp()
      Get the real time aggregation operation of this metric.
      Returns:
      Real time aggregation operation
    • setRealtimeAggregationOp

      public void setRealtimeAggregationOp(TimelineMetricOperation op)
      Set the real time aggregation operation of this metric.
      Parameters:
      op - A timeline metric operation that the metric should perform on real time aggregations
    • getValuesJAXB

      @Private public TreeMap<Long,Number> getValuesJAXB()
    • getValues

      public Map<Long,Number> getValues()
    • setValues

      public void setValues(Map<Long,Number> vals)
    • addValues

      public void addValues(Map<Long,Number> vals)
    • addValue

      public void addValue(long timestamp, Number value)
    • isValid

      public boolean isValid()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLatestSingleValueMetric

      public static TimelineMetric getLatestSingleValueMetric(TimelineMetric metric)
      Get the latest timeline metric as single value type.
      Parameters:
      metric - Incoming timeline metric
      Returns:
      The latest metric in the incoming metric
    • getSingleDataTimestamp

      public long getSingleDataTimestamp()
      Get single data timestamp of the metric.
      Returns:
      the single data timestamp
    • getSingleDataValue

      public Number getSingleDataValue()
      Get single data value of the metric.
      Returns:
      the single data value
    • aggregateTo

      public static TimelineMetric aggregateTo(TimelineMetric incomingMetric, TimelineMetric baseAggregatedMetric)
      Aggregate an incoming metric to the base aggregated metric with the given operation state in a stateless fashion. The assumption here is baseAggregatedMetric and latestMetric should be single value data if not null.
      Parameters:
      incomingMetric - Incoming timeline metric to aggregate
      baseAggregatedMetric - Base timeline metric
      Returns:
      Result metric after aggregation
    • aggregateTo

      public static TimelineMetric aggregateTo(TimelineMetric incomingMetric, TimelineMetric baseAggregatedMetric, Map<Object,Object> state)
      Aggregate an incoming metric to the base aggregated metric with the given operation state. The assumption here is baseAggregatedMetric and latestMetric should be single value data if not null.
      Parameters:
      incomingMetric - Incoming timeline metric to aggregate
      baseAggregatedMetric - Base timeline metric
      state - Operation state
      Returns:
      Result metric after aggregation