github.com/ferranbt/nomad@v0.9.3-0.20190607002617-85c449b7667c/plugins/shared/structs/stats.go (about)

     1  package structs
     2  
     3  // StatObject is a collection of statistics either exposed at the top
     4  // level or via nested StatObjects.
     5  type StatObject struct {
     6  	// Nested is a mapping of object name to a nested stats object.
     7  	Nested map[string]*StatObject
     8  
     9  	// Attributes is a mapping of statistic name to its value.
    10  	Attributes map[string]*StatValue
    11  }
    12  
    13  // StatValue exposes the values of a particular statistic. The value may be of
    14  // type float, integer, string or boolean. Numeric types can be exposed as a
    15  // single value or as a fraction.
    16  type StatValue struct {
    17  	// FloatNumeratorVal exposes a floating point value. If denominator is set
    18  	// it is assumed to be a fractional value, otherwise it is a scalar.
    19  	FloatNumeratorVal   *float64 `json:",omitempty"`
    20  	FloatDenominatorVal *float64 `json:",omitempty"`
    21  
    22  	// IntNumeratorVal exposes a int value. If denominator is set it is assumed
    23  	// to be a fractional value, otherwise it is a scalar.
    24  	IntNumeratorVal   *int64 `json:",omitempty"`
    25  	IntDenominatorVal *int64 `json:",omitempty"`
    26  
    27  	// StringVal exposes a string value. These are likely annotations.
    28  	StringVal *string `json:",omitempty"`
    29  
    30  	// BoolVal exposes a boolean statistic.
    31  	BoolVal *bool `json:",omitempty"`
    32  
    33  	// Unit gives the unit type: °F, %, MHz, MB, etc.
    34  	Unit string `json:",omitempty"`
    35  
    36  	// Desc provides a human readable description of the statistic.
    37  	Desc string `json:",omitempty"`
    38  }