Export API Overview

December 4, 2018 ยท View on GitHub

The stats library aggregates measurements into Views (which are essentially a collection of metrics, each with a different set of labels). All output objects are immutable. The core data types used are:

  • AggregationData: contains data from an Aggregation.
  • ViewData: encapsulates View data aggregation.

AggregationData

An AggregationData describes the result of data aggregation. The library SHOULD define an AggregationData for each Aggregation types defined.

The library SHOULD provide support for multiple types of Aggregations:

  • CountData: data generated for a Count aggregation.
  • SumDataDouble and SumDataInt64: data generated for a Sum aggregation based on the Measure type.
  • LastValueDataDouble and LastValueDataInt64: data generated for a LastValue aggregation based on the Measure type.
  • DistributionData: data generated for a Distribution aggregation. If there is a histogram in the Distribution, DistributionData may contain a list of Exemplars.

ViewData

A ViewData is defined from the following:

  • View: the exported View.
  • rows: a map of repeated tag values, and, dependent on Aggregation type in the View an AggregationData object. These contain the respective tag values corresponding to the columns parameter from the View and the aggregated data associated with those columns.
  • start_time: a timestamp, describing the start time of the current stats snapshot.
  • end_time: a timestamp, describing the end time of the current stats snapshot.

The library SHOULD provide a means of retrieving the ViewData for any registered view in the system.

ViewData is a language-specific data structure implementing the Metrics data model.

Aggregation to Metric

AggregationMeasure TypeMetric TypeValue TypeUnit
CountInt64 or DoubleCUMULATIVEINT64Dimensionless Unit
SumDoubleCUMULATIVEDOUBLEMeasure Unit
SumInt64CUMULATIVEINT64Measure Unit
LastValueDoubleGAUGEDOUBLEMeasure Unit
LastValueInt64GAUGEINT64Measure Unit
DistributionInt64 or DoubleCUMULATIVEDISTRIBUTIONMeasure Unit

Dimensionless Unit can be represented as "1".