TimelineMetric (Apache Hadoop YARN API 3.5.0 API)
Description: declaration: package: org.apache.hadoop.yarn.api.records.timelineservice, class: TimelineMetric

Package org.apache.hadoop.yarn.api.records.timelineservice

# Class TimelineMetric

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.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `TimelineMetric.Type`
  Type of metric.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TimelineMetric()`
  `TimelineMetric(TimelineMetric.Type type)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addValue(long timestamp, Number value)`
  `void`
  `addValues(Map<Long,Number> vals)`
  `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.
  `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.
  `boolean`
  `equals(Object o)`
  `String`
  `getId()`
  `static TimelineMetric`
  `getLatestSingleValueMetric(TimelineMetric metric)`
  Get the latest timeline metric as single value type.
  `TimelineMetricOperation`
  `getRealtimeAggregationOp()`
  Get the real time aggregation operation of this metric.
  `long`
  `getSingleDataTimestamp()`
  Get single data timestamp of the metric.
  `Number`
  `getSingleDataValue()`
  Get single data value of the metric.
  `TimelineMetric.Type`
  `getType()`
  `Map<Long,Number>`
  `getValues()`
  `TreeMap<Long,Number>`
  `getValuesJAXB()`
  `int`
  `hashCode()`
  `boolean`
  `isValid()`
  `void`
  `setId(String metricId)`
  `void`
  `setRealtimeAggregationOp(TimelineMetricOperation op)`
  Set the real time aggregation operation of this metric.
  `void`
  `setType(TimelineMetric.Type metricType)`
  `void`
  `setValues(Map<Long,Number> vals)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## 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