2018-11-12 00:36:20 +00:00
|
|
|
package structs
|
|
|
|
|
|
|
|
// StatObject is a collection of statistics either exposed at the top
|
|
|
|
// level or via nested StatObjects.
|
|
|
|
type StatObject struct {
|
|
|
|
// Nested is a mapping of object name to a nested stats object.
|
|
|
|
Nested map[string]*StatObject
|
|
|
|
|
|
|
|
// Attributes is a mapping of statistic name to its value.
|
|
|
|
Attributes map[string]*StatValue
|
|
|
|
}
|
|
|
|
|
|
|
|
// StatValue exposes the values of a particular statistic. The value may be of
|
|
|
|
// type float, integer, string or boolean. Numeric types can be exposed as a
|
|
|
|
// single value or as a fraction.
|
|
|
|
type StatValue struct {
|
|
|
|
// FloatNumeratorVal exposes a floating point value. If denominator is set
|
|
|
|
// it is assumed to be a fractional value, otherwise it is a scalar.
|
2018-11-13 16:49:14 +00:00
|
|
|
FloatNumeratorVal *float64 `json:",omitempty"`
|
|
|
|
FloatDenominatorVal *float64 `json:",omitempty"`
|
2018-11-12 00:36:20 +00:00
|
|
|
|
|
|
|
// IntNumeratorVal exposes a int value. If denominator is set it is assumed
|
|
|
|
// to be a fractional value, otherwise it is a scalar.
|
2018-11-13 16:49:14 +00:00
|
|
|
IntNumeratorVal *int64 `json:",omitempty"`
|
|
|
|
IntDenominatorVal *int64 `json:",omitempty"`
|
2018-11-12 00:36:20 +00:00
|
|
|
|
|
|
|
// StringVal exposes a string value. These are likely annotations.
|
2018-11-13 16:49:14 +00:00
|
|
|
StringVal *string `json:",omitempty"`
|
2018-11-12 00:36:20 +00:00
|
|
|
|
|
|
|
// BoolVal exposes a boolean statistic.
|
2018-11-13 16:49:14 +00:00
|
|
|
BoolVal *bool `json:",omitempty"`
|
2018-11-12 00:36:20 +00:00
|
|
|
|
|
|
|
// Unit gives the unit type: °F, %, MHz, MB, etc.
|
2018-11-13 16:49:14 +00:00
|
|
|
Unit string `json:",omitempty"`
|
2018-11-12 00:36:20 +00:00
|
|
|
|
|
|
|
// Desc provides a human readable description of the statistic.
|
2018-11-13 16:49:14 +00:00
|
|
|
Desc string `json:",omitempty"`
|
2018-11-12 00:36:20 +00:00
|
|
|
}
|