open-nomad/plugins/shared/structs/proto/stats.proto
Mahmood Ali c5de71a424 Allow nullable fields in StatValues
In state values, we need to be able to distinguish between zero values
(e.g. `false`) and unset values (e.g. `nil`).

We can alternatively use protobuf `oneOf` and nested map to ensure
consistency of fields that are set together, but the golang
representation does not represent that well and introducing a mismatch
between representations.  Thus, I opted not to use it.
2018-11-14 14:41:19 -05:00

45 lines
1.5 KiB
Protocol Buffer

syntax = "proto3";
package hashicorp.nomad.plugins.shared.structs;
option go_package = "proto";
import "google/protobuf/wrappers.proto";
// StatObject is a collection of statistics either exposed at the top
// level or via nested StatObjects.
message StatObject {
// nested is a mapping of object name to a nested stats object.
map<string, StatObject> nested = 1;
// attributes is a mapping of statistic name to its value.
map<string, StatValue> attributes = 2;
}
// StatValue exposes the values of a particular statistic. The value may
// be of type double, integer, string or boolean. Numeric types can be
// exposed as a single value or as a fraction.
message StatValue {
// float_numerator_val exposes a floating point value. If denominator
// is set it is assumed to be a fractional value, otherwise it is a
// scalar.
google.protobuf.DoubleValue float_numerator_val = 1;
google.protobuf.DoubleValue float_denominator_val = 2;
// int_numerator_val exposes a int value. If denominator
// is set it is assumed to be a fractional value, otherwise it is a
// scalar.
google.protobuf.Int64Value int_numerator_val = 3;
google.protobuf.Int64Value int_denominator_val = 4;
// string_val exposes a string value. These are likely annotations.
google.protobuf.StringValue string_val = 5;
// bool_val exposes a boolean statistic.
google.protobuf.BoolValue bool_val = 6;
// unit gives the unit type: °F, %, MHz, MB, etc.
string unit = 7;
// desc provides a human readable description of the statistic.
string desc = 8;
}