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 anAggregation.ViewData: encapsulatesViewdata aggregation.
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 aCountaggregation.SumDataDoubleandSumDataInt64: data generated for aSumaggregation based on theMeasuretype.LastValueDataDoubleandLastValueDataInt64: data generated for aLastValueaggregation based on theMeasuretype.DistributionData: data generated for aDistributionaggregation. If there is a histogram in theDistribution,DistributionDatamay contain a list ofExemplars.
A ViewData is defined from the following:
View: the exportedView.rows: a map of repeated tag values, and, dependent on Aggregation type in theViewanAggregationDataobject. These contain the respective tag values corresponding to thecolumnsparameter from theViewand the aggregated data associated with thosecolumns.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 | Measure Type | Metric Type | Value Type | Unit |
|---|---|---|---|---|
| Count | Int64 or Double | CUMULATIVE | INT64 | Dimensionless Unit |
| Sum | Double | CUMULATIVE | DOUBLE | Measure Unit |
| Sum | Int64 | CUMULATIVE | INT64 | Measure Unit |
| LastValue | Double | GAUGE | DOUBLE | Measure Unit |
| LastValue | Int64 | GAUGE | INT64 | Measure Unit |
| Distribution | Int64 or Double | CUMULATIVE | DISTRIBUTION | Measure Unit |
Dimensionless Unit can be represented as "1".