diff --git a/api/go/common/common.pb.go b/api/go/common/common.pb.go index e0ac12f5..b93b9d85 100644 --- a/api/go/common/common.pb.go +++ b/api/go/common/common.pb.go @@ -477,6 +477,58 @@ func (Aggregation) EnumDescriptor() ([]byte, []int) { return file_common_common_proto_rawDescGZIP(), []int{6} } +type MetricKind int32 + +const ( + // Incrementing counters that never decrease (these are not reset on each reading). + MetricKind_COUNTER MetricKind = 0 + // Counters that do get reset upon reading. + MetricKind_ABSOLUTE MetricKind = 1 + // E.g. a temperature value. + MetricKind_GAUGE MetricKind = 2 +) + +// Enum value maps for MetricKind. +var ( + MetricKind_name = map[int32]string{ + 0: "COUNTER", + 1: "ABSOLUTE", + 2: "GAUGE", + } + MetricKind_value = map[string]int32{ + "COUNTER": 0, + "ABSOLUTE": 1, + "GAUGE": 2, + } +) + +func (x MetricKind) Enum() *MetricKind { + p := new(MetricKind) + *p = x + return p +} + +func (x MetricKind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MetricKind) Descriptor() protoreflect.EnumDescriptor { + return file_common_common_proto_enumTypes[7].Descriptor() +} + +func (MetricKind) Type() protoreflect.EnumType { + return &file_common_common_proto_enumTypes[7] +} + +func (x MetricKind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MetricKind.Descriptor instead. +func (MetricKind) EnumDescriptor() ([]byte, []int) { + return file_common_common_proto_rawDescGZIP(), []int{7} +} + type Location struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -629,6 +681,8 @@ type Metric struct { Timestamps []*timestamppb.Timestamp `protobuf:"bytes,2,rep,name=timestamps,proto3" json:"timestamps,omitempty"` // Datasets. Datasets []*MetricDataset `protobuf:"bytes,3,rep,name=datasets,proto3" json:"datasets,omitempty"` + // Kind. + Kind MetricKind `protobuf:"varint,4,opt,name=kind,proto3,enum=common.MetricKind" json:"kind,omitempty"` } func (x *Metric) Reset() { @@ -684,6 +738,13 @@ func (x *Metric) GetDatasets() []*MetricDataset { return nil } +func (x *Metric) GetKind() MetricKind { + if x != nil { + return x.Kind + } + return MetricKind_COUNTER +} + type MetricDataset struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -764,7 +825,7 @@ var file_common_common_proto_rawDesc = []byte{ 0x6b, 0x65, 0x6b, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x6b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x61, 0x65, 0x73, 0x4b, - 0x65, 0x79, 0x22, 0x8b, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x12, 0x0a, + 0x65, 0x79, 0x22, 0xb3, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, @@ -773,67 +834,73 @@ var file_common_common_proto_rawDesc = []byte{ 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, - 0x22, 0x39, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x02, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x2a, 0x2c, 0x0a, 0x0a, 0x4d, - 0x6f, 0x64, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x52, - 0x41, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x53, 0x4b, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, - 0x4c, 0x52, 0x5f, 0x46, 0x48, 0x53, 0x53, 0x10, 0x02, 0x2a, 0xaa, 0x01, 0x0a, 0x06, 0x52, 0x65, - 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x55, 0x38, 0x36, 0x38, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x55, 0x53, 0x39, 0x31, 0x35, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4e, - 0x37, 0x37, 0x39, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x55, 0x34, 0x33, 0x33, 0x10, 0x04, - 0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, 0x39, 0x31, 0x35, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x43, - 0x4e, 0x34, 0x37, 0x30, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x53, 0x39, 0x32, 0x33, 0x10, - 0x07, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33, 0x5f, 0x32, 0x10, 0x0c, 0x12, 0x0b, - 0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33, 0x5f, 0x33, 0x10, 0x0d, 0x12, 0x0b, 0x0a, 0x07, 0x41, - 0x53, 0x39, 0x32, 0x33, 0x5f, 0x34, 0x10, 0x0e, 0x12, 0x09, 0x0a, 0x05, 0x4b, 0x52, 0x39, 0x32, - 0x30, 0x10, 0x08, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x4e, 0x38, 0x36, 0x35, 0x10, 0x09, 0x12, 0x09, - 0x0a, 0x05, 0x52, 0x55, 0x38, 0x36, 0x34, 0x10, 0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x53, 0x4d, - 0x32, 0x34, 0x30, 0x30, 0x10, 0x0b, 0x2a, 0xb3, 0x01, 0x0a, 0x05, 0x4d, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x10, 0x0a, 0x0c, 0x4a, 0x4f, 0x49, 0x4e, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, - 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4a, 0x4f, 0x49, 0x4e, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x50, - 0x54, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x4e, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, - 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, - 0x55, 0x4e, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, - 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x46, 0x49, - 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x10, 0x04, 0x12, 0x17, - 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, - 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x52, 0x45, 0x4a, 0x4f, 0x49, - 0x4e, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x06, 0x12, 0x0f, 0x0a, 0x0b, 0x50, - 0x52, 0x4f, 0x50, 0x52, 0x49, 0x45, 0x54, 0x41, 0x52, 0x59, 0x10, 0x07, 0x2a, 0x7e, 0x0a, 0x0a, - 0x4d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, - 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x10, 0x00, 0x12, 0x11, 0x0a, - 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x31, 0x10, 0x01, - 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, - 0x32, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, - 0x5f, 0x30, 0x5f, 0x33, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, - 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x34, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, - 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x31, 0x5f, 0x30, 0x10, 0x05, 0x2a, 0x65, 0x0a, 0x11, - 0x52, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x01, 0x12, - 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x10, 0x02, - 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x31, 0x10, - 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x32, - 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, - 0x33, 0x10, 0x05, 0x2a, 0x8e, 0x01, 0x0a, 0x0e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x50, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, - 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, - 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x54, 0x44, 0x4f, 0x41, 0x10, 0x03, 0x12, - 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, - 0x52, 0x53, 0x53, 0x49, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, - 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x47, 0x4e, 0x53, 0x53, 0x10, 0x05, 0x12, 0x15, 0x0a, - 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x57, 0x49, - 0x46, 0x49, 0x10, 0x06, 0x2a, 0x2b, 0x0a, 0x0b, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x4f, 0x55, 0x52, 0x10, 0x00, 0x12, 0x07, 0x0a, - 0x03, 0x44, 0x41, 0x59, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4d, 0x4f, 0x4e, 0x54, 0x48, 0x10, - 0x02, 0x42, 0x55, 0x0a, 0x11, 0x69, 0x6f, 0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, - 0x63, 0x6b, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x63, 0x68, 0x69, - 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76, - 0x34, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x26, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x69, + 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x39, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, + 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x02, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x2a, 0x2c, 0x0a, 0x0a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x52, 0x41, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x46, + 0x53, 0x4b, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x52, 0x5f, 0x46, 0x48, 0x53, 0x53, 0x10, + 0x02, 0x2a, 0xaa, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, + 0x45, 0x55, 0x38, 0x36, 0x38, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x53, 0x39, 0x31, 0x35, + 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4e, 0x37, 0x37, 0x39, 0x10, 0x03, 0x12, 0x09, 0x0a, + 0x05, 0x45, 0x55, 0x34, 0x33, 0x33, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, 0x39, 0x31, + 0x35, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4e, 0x34, 0x37, 0x30, 0x10, 0x06, 0x12, 0x09, + 0x0a, 0x05, 0x41, 0x53, 0x39, 0x32, 0x33, 0x10, 0x07, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x53, 0x39, + 0x32, 0x33, 0x5f, 0x32, 0x10, 0x0c, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33, 0x5f, + 0x33, 0x10, 0x0d, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33, 0x5f, 0x34, 0x10, 0x0e, + 0x12, 0x09, 0x0a, 0x05, 0x4b, 0x52, 0x39, 0x32, 0x30, 0x10, 0x08, 0x12, 0x09, 0x0a, 0x05, 0x49, + 0x4e, 0x38, 0x36, 0x35, 0x10, 0x09, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x55, 0x38, 0x36, 0x34, 0x10, + 0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x53, 0x4d, 0x32, 0x34, 0x30, 0x30, 0x10, 0x0b, 0x2a, 0xb3, + 0x01, 0x0a, 0x05, 0x4d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4a, 0x4f, 0x49, 0x4e, + 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4a, 0x4f, + 0x49, 0x4e, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x55, + 0x4e, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, + 0x55, 0x50, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x4e, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, + 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x12, + 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, + 0x41, 0x5f, 0x55, 0x50, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, + 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x05, 0x12, + 0x12, 0x0a, 0x0e, 0x52, 0x45, 0x4a, 0x4f, 0x49, 0x4e, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, + 0x54, 0x10, 0x06, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x52, 0x4f, 0x50, 0x52, 0x49, 0x45, 0x54, 0x41, + 0x52, 0x59, 0x10, 0x07, 0x2a, 0x7e, 0x0a, 0x0a, 0x4d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, + 0x30, 0x5f, 0x30, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, + 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x31, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, + 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x32, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x4c, + 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x33, 0x10, 0x03, 0x12, 0x11, + 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x34, 0x10, + 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x31, + 0x5f, 0x30, 0x10, 0x05, 0x2a, 0x65, 0x0a, 0x11, 0x52, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x00, + 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, + 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, + 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x31, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, + 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x32, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, + 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x33, 0x10, 0x05, 0x2a, 0x8e, 0x01, 0x0a, 0x0e, + 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0b, + 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, + 0x50, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x02, + 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, + 0x5f, 0x54, 0x44, 0x4f, 0x41, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, + 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x52, 0x53, 0x53, 0x49, 0x10, 0x04, 0x12, 0x15, + 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x47, + 0x4e, 0x53, 0x53, 0x10, 0x05, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, + 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x57, 0x49, 0x46, 0x49, 0x10, 0x06, 0x2a, 0x2b, 0x0a, 0x0b, + 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x48, + 0x4f, 0x55, 0x52, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x41, 0x59, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x4d, 0x4f, 0x4e, 0x54, 0x48, 0x10, 0x02, 0x2a, 0x32, 0x0a, 0x0a, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x55, 0x4e, 0x54, + 0x45, 0x52, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x42, 0x53, 0x4f, 0x4c, 0x55, 0x54, 0x45, + 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x41, 0x55, 0x47, 0x45, 0x10, 0x02, 0x42, 0x55, 0x0a, + 0x11, 0x69, 0x6f, 0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x61, + 0x70, 0x69, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, + 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, + 0x61, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -848,7 +915,7 @@ func file_common_common_proto_rawDescGZIP() []byte { return file_common_common_proto_rawDescData } -var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 7) +var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 8) var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_common_common_proto_goTypes = []interface{}{ (Modulation)(0), // 0: common.Modulation @@ -858,21 +925,23 @@ var file_common_common_proto_goTypes = []interface{}{ (RegParamsRevision)(0), // 4: common.RegParamsRevision (LocationSource)(0), // 5: common.LocationSource (Aggregation)(0), // 6: common.Aggregation - (*Location)(nil), // 7: common.Location - (*KeyEnvelope)(nil), // 8: common.KeyEnvelope - (*Metric)(nil), // 9: common.Metric - (*MetricDataset)(nil), // 10: common.MetricDataset - (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp + (MetricKind)(0), // 7: common.MetricKind + (*Location)(nil), // 8: common.Location + (*KeyEnvelope)(nil), // 9: common.KeyEnvelope + (*Metric)(nil), // 10: common.Metric + (*MetricDataset)(nil), // 11: common.MetricDataset + (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp } var file_common_common_proto_depIdxs = []int32{ 5, // 0: common.Location.source:type_name -> common.LocationSource - 11, // 1: common.Metric.timestamps:type_name -> google.protobuf.Timestamp - 10, // 2: common.Metric.datasets:type_name -> common.MetricDataset - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 12, // 1: common.Metric.timestamps:type_name -> google.protobuf.Timestamp + 11, // 2: common.Metric.datasets:type_name -> common.MetricDataset + 7, // 3: common.Metric.kind:type_name -> common.MetricKind + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_common_common_proto_init() } @@ -935,7 +1004,7 @@ func file_common_common_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_common_common_proto_rawDesc, - NumEnums: 7, + NumEnums: 8, NumMessages: 4, NumExtensions: 0, NumServices: 0, diff --git a/api/grpc-web/common/common_pb.d.ts b/api/grpc-web/common/common_pb.d.ts index c04732ca..3b810413 100644 --- a/api/grpc-web/common/common_pb.d.ts +++ b/api/grpc-web/common/common_pb.d.ts @@ -75,6 +75,9 @@ export class Metric extends jspb.Message { clearDatasetsList(): Metric; addDatasets(value?: MetricDataset, index?: number): MetricDataset; + getKind(): MetricKind; + setKind(value: MetricKind): Metric; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Metric.AsObject; static toObject(includeInstance: boolean, msg: Metric): Metric.AsObject; @@ -88,6 +91,7 @@ export namespace Metric { name: string, timestampsList: Array, datasetsList: Array, + kind: MetricKind, } } @@ -176,3 +180,8 @@ export enum Aggregation { DAY = 1, MONTH = 2, } +export enum MetricKind { + COUNTER = 0, + ABSOLUTE = 1, + GAUGE = 2, +} diff --git a/api/grpc-web/common/common_pb.js b/api/grpc-web/common/common_pb.js index 9a161141..25d0d131 100644 --- a/api/grpc-web/common/common_pb.js +++ b/api/grpc-web/common/common_pb.js @@ -25,6 +25,7 @@ goog.exportSymbol('proto.common.MType', null, global); goog.exportSymbol('proto.common.MacVersion', null, global); goog.exportSymbol('proto.common.Metric', null, global); goog.exportSymbol('proto.common.MetricDataset', null, global); +goog.exportSymbol('proto.common.MetricKind', null, global); goog.exportSymbol('proto.common.Modulation', null, global); goog.exportSymbol('proto.common.RegParamsRevision', null, global); goog.exportSymbol('proto.common.Region', null, global); @@ -589,7 +590,8 @@ proto.common.Metric.toObject = function(includeInstance, msg) { timestampsList: jspb.Message.toObjectList(msg.getTimestampsList(), google_protobuf_timestamp_pb.Timestamp.toObject, includeInstance), datasetsList: jspb.Message.toObjectList(msg.getDatasetsList(), - proto.common.MetricDataset.toObject, includeInstance) + proto.common.MetricDataset.toObject, includeInstance), + kind: jspb.Message.getFieldWithDefault(msg, 4, 0) }; if (includeInstance) { @@ -640,6 +642,10 @@ proto.common.Metric.deserializeBinaryFromReader = function(msg, reader) { reader.readMessage(value,proto.common.MetricDataset.deserializeBinaryFromReader); msg.addDatasets(value); break; + case 4: + var value = /** @type {!proto.common.MetricKind} */ (reader.readEnum()); + msg.setKind(value); + break; default: reader.skipField(); break; @@ -692,6 +698,13 @@ proto.common.Metric.serializeBinaryToWriter = function(message, writer) { proto.common.MetricDataset.serializeBinaryToWriter ); } + f = message.getKind(); + if (f !== 0.0) { + writer.writeEnum( + 4, + f + ); + } }; @@ -789,6 +802,24 @@ proto.common.Metric.prototype.clearDatasetsList = function() { }; +/** + * optional MetricKind kind = 4; + * @return {!proto.common.MetricKind} + */ +proto.common.Metric.prototype.getKind = function() { + return /** @type {!proto.common.MetricKind} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {!proto.common.MetricKind} value + * @return {!proto.common.Metric} returns this + */ +proto.common.Metric.prototype.setKind = function(value) { + return jspb.Message.setProto3EnumField(this, 4, value); +}; + + /** * List of repeated fields within this message type. @@ -1066,4 +1097,13 @@ proto.common.Aggregation = { MONTH: 2 }; +/** + * @enum {number} + */ +proto.common.MetricKind = { + COUNTER: 0, + ABSOLUTE: 1, + GAUGE: 2 +}; + goog.object.extend(exports, proto.common); diff --git a/api/js/common/common_pb.d.ts b/api/js/common/common_pb.d.ts index a077fa22..2e2ab38b 100644 --- a/api/js/common/common_pb.d.ts +++ b/api/js/common/common_pb.d.ts @@ -80,6 +80,9 @@ export class Metric extends jspb.Message { setDatasetsList(value: Array): void; addDatasets(value?: MetricDataset, index?: number): MetricDataset; + getKind(): MetricKindMap[keyof MetricKindMap]; + setKind(value: MetricKindMap[keyof MetricKindMap]): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Metric.AsObject; static toObject(includeInstance: boolean, msg: Metric): Metric.AsObject; @@ -95,6 +98,7 @@ export namespace Metric { name: string, timestampsList: Array, datasetsList: Array, + kind: MetricKindMap[keyof MetricKindMap], } } @@ -206,3 +210,11 @@ export interface AggregationMap { export const Aggregation: AggregationMap; +export interface MetricKindMap { + COUNTER: 0; + ABSOLUTE: 1; + GAUGE: 2; +} + +export const MetricKind: MetricKindMap; + diff --git a/api/js/common/common_pb.js b/api/js/common/common_pb.js index 89249654..ce007c92 100644 --- a/api/js/common/common_pb.js +++ b/api/js/common/common_pb.js @@ -18,6 +18,7 @@ goog.exportSymbol('proto.common.MType', null, global); goog.exportSymbol('proto.common.MacVersion', null, global); goog.exportSymbol('proto.common.Metric', null, global); goog.exportSymbol('proto.common.MetricDataset', null, global); +goog.exportSymbol('proto.common.MetricKind', null, global); goog.exportSymbol('proto.common.Modulation', null, global); goog.exportSymbol('proto.common.RegParamsRevision', null, global); goog.exportSymbol('proto.common.Region', null, global); @@ -555,7 +556,8 @@ proto.common.Metric.toObject = function(includeInstance, msg) { timestampsList: jspb.Message.toObjectList(msg.getTimestampsList(), google_protobuf_timestamp_pb.Timestamp.toObject, includeInstance), datasetsList: jspb.Message.toObjectList(msg.getDatasetsList(), - proto.common.MetricDataset.toObject, includeInstance) + proto.common.MetricDataset.toObject, includeInstance), + kind: msg.getKind() }; if (includeInstance) { @@ -608,6 +610,10 @@ proto.common.Metric.deserializeBinaryFromReader = function(msg, reader) { msg.getDatasetsList().push(value); msg.setDatasetsList(msg.getDatasetsList()); break; + case 4: + var value = /** @type {!proto.common.MetricKind} */ (reader.readEnum()); + msg.setKind(value); + break; default: reader.skipField(); break; @@ -669,6 +675,13 @@ proto.common.Metric.prototype.serializeBinaryToWriter = function (writer) { proto.common.MetricDataset.serializeBinaryToWriter ); } + f = this.getKind(); + if (f !== 0.0) { + writer.writeEnum( + 4, + f + ); + } }; @@ -742,6 +755,21 @@ proto.common.Metric.prototype.clearDatasetsList = function() { }; +/** + * optional MetricKind kind = 4; + * @return {!proto.common.MetricKind} + */ +proto.common.Metric.prototype.getKind = function() { + return /** @type {!proto.common.MetricKind} */ (jspb.Message.getFieldProto3(this, 4, 0)); +}; + + +/** @param {!proto.common.MetricKind} value */ +proto.common.Metric.prototype.setKind = function(value) { + jspb.Message.setField(this, 4, value); +}; + + /** * Generated by JsPbCodeGenerator. @@ -1031,4 +1059,13 @@ proto.common.Aggregation = { MONTH: 2 }; +/** + * @enum {number} + */ +proto.common.MetricKind = { + COUNTER: 0, + ABSOLUTE: 1, + GAUGE: 2 +}; + goog.object.extend(exports, proto.common); diff --git a/api/proto/common/common.proto b/api/proto/common/common.proto index 791bd235..f2b68e65 100644 --- a/api/proto/common/common.proto +++ b/api/proto/common/common.proto @@ -142,6 +142,17 @@ enum Aggregation { MONTH = 2; } +enum MetricKind { + // Incrementing counters that never decrease (these are not reset on each reading). + COUNTER = 0; + + // Counters that do get reset upon reading. + ABSOLUTE = 1; + + // E.g. a temperature value. + GAUGE = 2; +} + message Location { // Latitude. double latitude = 1; @@ -176,6 +187,9 @@ message Metric { // Datasets. repeated MetricDataset datasets = 3; + + // Kind. + MetricKind kind = 4; } message MetricDataset { diff --git a/api/python/proto/chirpstack-api/common/common.proto b/api/python/proto/chirpstack-api/common/common.proto index 791bd235..f2b68e65 100644 --- a/api/python/proto/chirpstack-api/common/common.proto +++ b/api/python/proto/chirpstack-api/common/common.proto @@ -142,6 +142,17 @@ enum Aggregation { MONTH = 2; } +enum MetricKind { + // Incrementing counters that never decrease (these are not reset on each reading). + COUNTER = 0; + + // Counters that do get reset upon reading. + ABSOLUTE = 1; + + // E.g. a temperature value. + GAUGE = 2; +} + message Location { // Latitude. double latitude = 1; @@ -176,6 +187,9 @@ message Metric { // Datasets. repeated MetricDataset datasets = 3; + + // Kind. + MetricKind kind = 4; } message MetricDataset { diff --git a/api/python/src/chirpstack_api/common/common_pb2.py b/api/python/src/chirpstack_api/common/common_pb2.py index 59ca7da4..a29d019f 100644 --- a/api/python/src/chirpstack_api/common/common_pb2.py +++ b/api/python/src/chirpstack_api/common/common_pb2.py @@ -16,7 +16,7 @@ _sym_db = _symbol_database.Default() from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"chirpstack-api/common/common.proto\x12\x06\x63ommon\x1a\x1fgoogle/protobuf/timestamp.proto\"{\n\x08Location\x12\x10\n\x08latitude\x18\x01 \x01(\x01\x12\x11\n\tlongitude\x18\x02 \x01(\x01\x12\x10\n\x08\x61ltitude\x18\x03 \x01(\x01\x12&\n\x06source\x18\x04 \x01(\x0e\x32\x16.common.LocationSource\x12\x10\n\x08\x61\x63\x63uracy\x18\x05 \x01(\x02\"1\n\x0bKeyEnvelope\x12\x11\n\tkek_label\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x65s_key\x18\x02 \x01(\x0c\"o\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\ntimestamps\x18\x02 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x08\x64\x61tasets\x18\x03 \x03(\x0b\x32\x15.common.MetricDataset\",\n\rMetricDataset\x12\r\n\x05label\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x03(\x02*,\n\nModulation\x12\x08\n\x04LORA\x10\x00\x12\x07\n\x03\x46SK\x10\x01\x12\x0b\n\x07LR_FHSS\x10\x02*\xaa\x01\n\x06Region\x12\t\n\x05\x45U868\x10\x00\x12\t\n\x05US915\x10\x02\x12\t\n\x05\x43N779\x10\x03\x12\t\n\x05\x45U433\x10\x04\x12\t\n\x05\x41U915\x10\x05\x12\t\n\x05\x43N470\x10\x06\x12\t\n\x05\x41S923\x10\x07\x12\x0b\n\x07\x41S923_2\x10\x0c\x12\x0b\n\x07\x41S923_3\x10\r\x12\x0b\n\x07\x41S923_4\x10\x0e\x12\t\n\x05KR920\x10\x08\x12\t\n\x05IN865\x10\t\x12\t\n\x05RU864\x10\n\x12\x0b\n\x07ISM2400\x10\x0b*\xb3\x01\n\x05MType\x12\x10\n\x0cJOIN_REQUEST\x10\x00\x12\x0f\n\x0bJOIN_ACCEPT\x10\x01\x12\x17\n\x13UNCONFIRMED_DATA_UP\x10\x02\x12\x19\n\x15UNCONFIRMED_DATA_DOWN\x10\x03\x12\x15\n\x11\x43ONFIRMED_DATA_UP\x10\x04\x12\x17\n\x13\x43ONFIRMED_DATA_DOWN\x10\x05\x12\x12\n\x0eREJOIN_REQUEST\x10\x06\x12\x0f\n\x0bPROPRIETARY\x10\x07*~\n\nMacVersion\x12\x11\n\rLORAWAN_1_0_0\x10\x00\x12\x11\n\rLORAWAN_1_0_1\x10\x01\x12\x11\n\rLORAWAN_1_0_2\x10\x02\x12\x11\n\rLORAWAN_1_0_3\x10\x03\x12\x11\n\rLORAWAN_1_0_4\x10\x04\x12\x11\n\rLORAWAN_1_1_0\x10\x05*e\n\x11RegParamsRevision\x12\x05\n\x01\x41\x10\x00\x12\x05\n\x01\x42\x10\x01\x12\x0f\n\x0bRP002_1_0_0\x10\x02\x12\x0f\n\x0bRP002_1_0_1\x10\x03\x12\x0f\n\x0bRP002_1_0_2\x10\x04\x12\x0f\n\x0bRP002_1_0_3\x10\x05*\x8e\x01\n\x0eLocationSource\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03GPS\x10\x01\x12\n\n\x06\x43ONFIG\x10\x02\x12\x15\n\x11GEO_RESOLVER_TDOA\x10\x03\x12\x15\n\x11GEO_RESOLVER_RSSI\x10\x04\x12\x15\n\x11GEO_RESOLVER_GNSS\x10\x05\x12\x15\n\x11GEO_RESOLVER_WIFI\x10\x06*+\n\x0b\x41ggregation\x12\x08\n\x04HOUR\x10\x00\x12\x07\n\x03\x44\x41Y\x10\x01\x12\t\n\x05MONTH\x10\x02\x42U\n\x11io.chirpstack.apiB\x0b\x43ommonProtoP\x01Z1github.com/chirpstack/chirpstack/api/go/v4/commonb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"chirpstack-api/common/common.proto\x12\x06\x63ommon\x1a\x1fgoogle/protobuf/timestamp.proto\"{\n\x08Location\x12\x10\n\x08latitude\x18\x01 \x01(\x01\x12\x11\n\tlongitude\x18\x02 \x01(\x01\x12\x10\n\x08\x61ltitude\x18\x03 \x01(\x01\x12&\n\x06source\x18\x04 \x01(\x0e\x32\x16.common.LocationSource\x12\x10\n\x08\x61\x63\x63uracy\x18\x05 \x01(\x02\"1\n\x0bKeyEnvelope\x12\x11\n\tkek_label\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x65s_key\x18\x02 \x01(\x0c\"\x91\x01\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\ntimestamps\x18\x02 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x08\x64\x61tasets\x18\x03 \x03(\x0b\x32\x15.common.MetricDataset\x12 \n\x04kind\x18\x04 \x01(\x0e\x32\x12.common.MetricKind\",\n\rMetricDataset\x12\r\n\x05label\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x03(\x02*,\n\nModulation\x12\x08\n\x04LORA\x10\x00\x12\x07\n\x03\x46SK\x10\x01\x12\x0b\n\x07LR_FHSS\x10\x02*\xaa\x01\n\x06Region\x12\t\n\x05\x45U868\x10\x00\x12\t\n\x05US915\x10\x02\x12\t\n\x05\x43N779\x10\x03\x12\t\n\x05\x45U433\x10\x04\x12\t\n\x05\x41U915\x10\x05\x12\t\n\x05\x43N470\x10\x06\x12\t\n\x05\x41S923\x10\x07\x12\x0b\n\x07\x41S923_2\x10\x0c\x12\x0b\n\x07\x41S923_3\x10\r\x12\x0b\n\x07\x41S923_4\x10\x0e\x12\t\n\x05KR920\x10\x08\x12\t\n\x05IN865\x10\t\x12\t\n\x05RU864\x10\n\x12\x0b\n\x07ISM2400\x10\x0b*\xb3\x01\n\x05MType\x12\x10\n\x0cJOIN_REQUEST\x10\x00\x12\x0f\n\x0bJOIN_ACCEPT\x10\x01\x12\x17\n\x13UNCONFIRMED_DATA_UP\x10\x02\x12\x19\n\x15UNCONFIRMED_DATA_DOWN\x10\x03\x12\x15\n\x11\x43ONFIRMED_DATA_UP\x10\x04\x12\x17\n\x13\x43ONFIRMED_DATA_DOWN\x10\x05\x12\x12\n\x0eREJOIN_REQUEST\x10\x06\x12\x0f\n\x0bPROPRIETARY\x10\x07*~\n\nMacVersion\x12\x11\n\rLORAWAN_1_0_0\x10\x00\x12\x11\n\rLORAWAN_1_0_1\x10\x01\x12\x11\n\rLORAWAN_1_0_2\x10\x02\x12\x11\n\rLORAWAN_1_0_3\x10\x03\x12\x11\n\rLORAWAN_1_0_4\x10\x04\x12\x11\n\rLORAWAN_1_1_0\x10\x05*e\n\x11RegParamsRevision\x12\x05\n\x01\x41\x10\x00\x12\x05\n\x01\x42\x10\x01\x12\x0f\n\x0bRP002_1_0_0\x10\x02\x12\x0f\n\x0bRP002_1_0_1\x10\x03\x12\x0f\n\x0bRP002_1_0_2\x10\x04\x12\x0f\n\x0bRP002_1_0_3\x10\x05*\x8e\x01\n\x0eLocationSource\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03GPS\x10\x01\x12\n\n\x06\x43ONFIG\x10\x02\x12\x15\n\x11GEO_RESOLVER_TDOA\x10\x03\x12\x15\n\x11GEO_RESOLVER_RSSI\x10\x04\x12\x15\n\x11GEO_RESOLVER_GNSS\x10\x05\x12\x15\n\x11GEO_RESOLVER_WIFI\x10\x06*+\n\x0b\x41ggregation\x12\x08\n\x04HOUR\x10\x00\x12\x07\n\x03\x44\x41Y\x10\x01\x12\t\n\x05MONTH\x10\x02*2\n\nMetricKind\x12\x0b\n\x07\x43OUNTER\x10\x00\x12\x0c\n\x08\x41\x42SOLUTE\x10\x01\x12\t\n\x05GAUGE\x10\x02\x42U\n\x11io.chirpstack.apiB\x0b\x43ommonProtoP\x01Z1github.com/chirpstack/chirpstack/api/go/v4/commonb\x06proto3') _MODULATION = DESCRIPTOR.enum_types_by_name['Modulation'] Modulation = enum_type_wrapper.EnumTypeWrapper(_MODULATION) @@ -32,6 +32,8 @@ _LOCATIONSOURCE = DESCRIPTOR.enum_types_by_name['LocationSource'] LocationSource = enum_type_wrapper.EnumTypeWrapper(_LOCATIONSOURCE) _AGGREGATION = DESCRIPTOR.enum_types_by_name['Aggregation'] Aggregation = enum_type_wrapper.EnumTypeWrapper(_AGGREGATION) +_METRICKIND = DESCRIPTOR.enum_types_by_name['MetricKind'] +MetricKind = enum_type_wrapper.EnumTypeWrapper(_METRICKIND) LORA = 0 FSK = 1 LR_FHSS = 2 @@ -79,6 +81,9 @@ GEO_RESOLVER_WIFI = 6 HOUR = 0 DAY = 1 MONTH = 2 +COUNTER = 0 +ABSOLUTE = 1 +GAUGE = 2 _LOCATION = DESCRIPTOR.message_types_by_name['Location'] @@ -117,26 +122,28 @@ if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\021io.chirpstack.apiB\013CommonProtoP\001Z1github.com/chirpstack/chirpstack/api/go/v4/common' - _MODULATION._serialized_start=414 - _MODULATION._serialized_end=458 - _REGION._serialized_start=461 - _REGION._serialized_end=631 - _MTYPE._serialized_start=634 - _MTYPE._serialized_end=813 - _MACVERSION._serialized_start=815 - _MACVERSION._serialized_end=941 - _REGPARAMSREVISION._serialized_start=943 - _REGPARAMSREVISION._serialized_end=1044 - _LOCATIONSOURCE._serialized_start=1047 - _LOCATIONSOURCE._serialized_end=1189 - _AGGREGATION._serialized_start=1191 - _AGGREGATION._serialized_end=1234 + _MODULATION._serialized_start=449 + _MODULATION._serialized_end=493 + _REGION._serialized_start=496 + _REGION._serialized_end=666 + _MTYPE._serialized_start=669 + _MTYPE._serialized_end=848 + _MACVERSION._serialized_start=850 + _MACVERSION._serialized_end=976 + _REGPARAMSREVISION._serialized_start=978 + _REGPARAMSREVISION._serialized_end=1079 + _LOCATIONSOURCE._serialized_start=1082 + _LOCATIONSOURCE._serialized_end=1224 + _AGGREGATION._serialized_start=1226 + _AGGREGATION._serialized_end=1269 + _METRICKIND._serialized_start=1271 + _METRICKIND._serialized_end=1321 _LOCATION._serialized_start=79 _LOCATION._serialized_end=202 _KEYENVELOPE._serialized_start=204 _KEYENVELOPE._serialized_end=253 - _METRIC._serialized_start=255 - _METRIC._serialized_end=366 - _METRICDATASET._serialized_start=368 - _METRICDATASET._serialized_end=412 + _METRIC._serialized_start=256 + _METRIC._serialized_end=401 + _METRICDATASET._serialized_start=403 + _METRICDATASET._serialized_end=447 # @@protoc_insertion_point(module_scope) diff --git a/api/rust/Cargo.lock b/api/rust/Cargo.lock index 46f83a76..b31adf8d 100644 --- a/api/rust/Cargo.lock +++ b/api/rust/Cargo.lock @@ -121,7 +121,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chirpstack_api" -version = "4.0.0-test.13" +version = "4.0.0-test.14" dependencies = [ "hex", "pbjson", diff --git a/api/rust/proto/chirpstack/common/common.proto b/api/rust/proto/chirpstack/common/common.proto index 791bd235..f2b68e65 100644 --- a/api/rust/proto/chirpstack/common/common.proto +++ b/api/rust/proto/chirpstack/common/common.proto @@ -142,6 +142,17 @@ enum Aggregation { MONTH = 2; } +enum MetricKind { + // Incrementing counters that never decrease (these are not reset on each reading). + COUNTER = 0; + + // Counters that do get reset upon reading. + ABSOLUTE = 1; + + // E.g. a temperature value. + GAUGE = 2; +} + message Location { // Latitude. double latitude = 1; @@ -176,6 +187,9 @@ message Metric { // Datasets. repeated MetricDataset datasets = 3; + + // Kind. + MetricKind kind = 4; } message MetricDataset { diff --git a/chirpstack/src/api/device.rs b/chirpstack/src/api/device.rs index 396c9b29..9b21447e 100644 --- a/chirpstack/src/api/device.rs +++ b/chirpstack/src/api/device.rs @@ -664,6 +664,12 @@ impl DeviceService for Device { }) .collect(), }], + kind: match v.kind { + fields::MeasurementKind::COUNTER => common::MetricKind::Counter, + fields::MeasurementKind::ABSOLUTE => common::MetricKind::Absolute, + fields::MeasurementKind::GAUGE | _ => common::MetricKind::Gauge, + } + .into(), }, ); } @@ -737,6 +743,7 @@ impl DeviceService for Device { .map(|row| row.metrics.get("rx_count").cloned().unwrap_or(0.0) as f32) .collect(), }], + kind: common::MetricKind::Absolute.into(), }), gw_rssi: Some(common::Metric { name: "RSSI".to_string(), @@ -763,6 +770,7 @@ impl DeviceService for Device { }) .collect(), }], + kind: common::MetricKind::Absolute.into(), }), gw_snr: Some(common::Metric { name: "SNR".to_string(), @@ -789,6 +797,7 @@ impl DeviceService for Device { }) .collect(), }], + kind: common::MetricKind::Absolute.into(), }), rx_packets_per_freq: Some({ // discover all data-sets @@ -826,6 +835,7 @@ impl DeviceService for Device { .collect(), }) .collect(), + kind: common::MetricKind::Absolute.into(), } }), rx_packets_per_dr: Some({ @@ -864,6 +874,7 @@ impl DeviceService for Device { .collect(), }) .collect(), + kind: common::MetricKind::Absolute.into(), } }), errors: Some({ @@ -902,6 +913,7 @@ impl DeviceService for Device { .collect(), }) .collect(), + kind: common::MetricKind::Absolute.into(), } }), }; diff --git a/chirpstack/src/api/gateway.rs b/chirpstack/src/api/gateway.rs index e18e7aa8..ccd3c9ca 100644 --- a/chirpstack/src/api/gateway.rs +++ b/chirpstack/src/api/gateway.rs @@ -326,6 +326,7 @@ impl GatewayService for Gateway { .map(|row| row.metrics.get("rx_count").cloned().unwrap_or(0.0) as f32) .collect(), }], + kind: common::MetricKind::Absolute.into(), }), tx_packets: Some(common::Metric { name: "Transmitted".to_string(), @@ -344,6 +345,7 @@ impl GatewayService for Gateway { .map(|row| row.metrics.get("tx_count").cloned().unwrap_or(0.0) as f32) .collect(), }], + kind: common::MetricKind::Absolute.into(), }), tx_packets_per_freq: Some({ // discover all data-sets @@ -381,6 +383,7 @@ impl GatewayService for Gateway { .collect(), }) .collect(), + kind: common::MetricKind::Absolute.into(), } }), rx_packets_per_freq: Some({ @@ -419,6 +422,7 @@ impl GatewayService for Gateway { .collect(), }) .collect(), + kind: common::MetricKind::Absolute.into(), } }), rx_packets_per_dr: Some({ @@ -457,6 +461,7 @@ impl GatewayService for Gateway { .collect(), }) .collect(), + kind: common::MetricKind::Absolute.into(), } }), tx_packets_per_dr: Some({ @@ -495,6 +500,7 @@ impl GatewayService for Gateway { .collect(), }) .collect(), + kind: common::MetricKind::Absolute.into(), } }), tx_packets_per_status: Some({ @@ -533,6 +539,7 @@ impl GatewayService for Gateway { .collect(), }) .collect(), + kind: common::MetricKind::Absolute.into(), } }), }; @@ -781,6 +788,7 @@ pub mod test { label: "rx_count".to_string(), data: vec![10.0], }], + kind: common::MetricKind::Absolute.into(), }), stats_resp.rx_packets ); diff --git a/ui/src/components/MetricChart.tsx b/ui/src/components/MetricChart.tsx index e8172a6b..34bf7503 100644 --- a/ui/src/components/MetricChart.tsx +++ b/ui/src/components/MetricChart.tsx @@ -6,7 +6,7 @@ import { TimeUnit } from "chart.js"; import { Line } from "react-chartjs-2"; import moment from "moment"; -import { Metric, Aggregation } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; +import { Metric, Aggregation, MetricKind } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; interface IProps { metric: Metric; @@ -46,6 +46,7 @@ class MetricChart extends Component { }, }; + let prevValue = 0; let data = { labels: this.props.metric.getTimestampsList().map(v => moment(v.toDate()).valueOf()), datasets: this.props.metric.getDatasetsList().map(v => { @@ -59,15 +60,29 @@ class MetricChart extends Component { if (v === 0 && this.props.zeroToNull) { return null; } else { - return v; + if (this.props.metric.getKind() === MetricKind.COUNTER) { + let val = v - prevValue; + prevValue = v; + if (val < 0) { + return 0; + } + return val; + } else { + return v; + } } }), }; }), }; + let name = this.props.metric.getName(); + if (this.props.metric.getKind() === MetricKind.COUNTER) { + name = `${name} (per ${unit})`; + } + return ( - + );