From 3019addbc54328413643ea5acc10ac02c155b9c4 Mon Sep 17 00:00:00 2001 From: Ivan <2103732+codebien@users.noreply.github.com> Date: Wed, 5 Jul 2023 17:35:00 +0200 Subject: [PATCH] cloudv2/pbcloud: Compact histogram --- output/cloud/expv2/pbcloud/metric.pb.go | 240 ++++++++++++++++-------- output/cloud/expv2/pbcloud/metric.proto | 34 ++-- 2 files changed, 180 insertions(+), 94 deletions(-) diff --git a/output/cloud/expv2/pbcloud/metric.pb.go b/output/cloud/expv2/pbcloud/metric.pb.go index 76e053b50867..6b4723554191 100644 --- a/output/cloud/expv2/pbcloud/metric.pb.go +++ b/output/cloud/expv2/pbcloud/metric.pb.go @@ -797,6 +797,65 @@ func (x *RateValue) GetTotalCount() uint32 { return 0 } +// BucketSpan represents the consecutive and significant (non-zero) buckets. +// The concept is imported from the Prometheus' native histogram. +// It should simplify an eventual transition to Prometheus. +// https://github.com/prometheus/prometheus/blob/f399f386cef3b19c48157e9678a4f50997db3f41/prompb/io/prometheus/client/metrics.proto#L115-L124 +type BucketSpan struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Offset uint32 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` // Gap to previous span, or starting point for 1st span. + Length uint32 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"` // Length of the next consecutive buckets. +} + +func (x *BucketSpan) Reset() { + *x = BucketSpan{} + if protoimpl.UnsafeEnabled { + mi := &file_metric_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BucketSpan) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BucketSpan) ProtoMessage() {} + +func (x *BucketSpan) ProtoReflect() protoreflect.Message { + mi := &file_metric_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BucketSpan.ProtoReflect.Descriptor instead. +func (*BucketSpan) Descriptor() ([]byte, []int) { + return file_metric_proto_rawDescGZIP(), []int{11} +} + +func (x *BucketSpan) GetOffset() uint32 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *BucketSpan) GetLength() uint32 { + if x != nil { + return x.Length + } + return 0 +} + type TrendHdrValue struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -804,32 +863,31 @@ type TrendHdrValue struct { // Required. Time *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"` - // buckets - Counters []uint32 `protobuf:"varint,2,rep,packed,name=counters,proto3" json:"counters,omitempty"` - // index of first bucket in `counters` - LowerCounterIndex uint32 `protobuf:"varint,3,opt,name=lower_counter_index,json=lowerCounterIndex,proto3" json:"lower_counter_index,omitempty"` + // positive buckets starting from bucket 1, each counter is an absolute value. + Counters []uint32 `protobuf:"varint,2,rep,packed,name=counters,proto3" json:"counters,omitempty"` + Spans []*BucketSpan `protobuf:"bytes,3,rep,name=spans,proto3" json:"spans,omitempty"` // sum of observations - Sum float64 `protobuf:"fixed64,4,opt,name=sum,proto3" json:"sum,omitempty"` + Sum float64 `protobuf:"fixed64,5,opt,name=sum,proto3" json:"sum,omitempty"` // count of observations - Count uint32 `protobuf:"varint,5,opt,name=count,proto3" json:"count,omitempty"` + Count uint32 `protobuf:"varint,6,opt,name=count,proto3" json:"count,omitempty"` // smallest and largest observed value - MinValue float64 `protobuf:"fixed64,6,opt,name=min_value,json=minValue,proto3" json:"min_value,omitempty"` - MaxValue float64 `protobuf:"fixed64,7,opt,name=max_value,json=maxValue,proto3" json:"max_value,omitempty"` - // counters for zero and infinity buckets - ExtraLowValuesCounter *uint32 `protobuf:"varint,8,opt,name=extra_low_values_counter,json=extraLowValuesCounter,proto3,oneof" json:"extra_low_values_counter,omitempty"` - ExtraHighValuesCounter *uint32 `protobuf:"varint,9,opt,name=extra_high_values_counter,json=extraHighValuesCounter,proto3,oneof" json:"extra_high_values_counter,omitempty"` + MinValue float64 `protobuf:"fixed64,7,opt,name=min_value,json=minValue,proto3" json:"min_value,omitempty"` + MaxValue float64 `protobuf:"fixed64,8,opt,name=max_value,json=maxValue,proto3" json:"max_value,omitempty"` + // counters for zero- and infinity-buckets + ExtraLowValuesCounter *uint32 `protobuf:"varint,9,opt,name=extra_low_values_counter,json=extraLowValuesCounter,proto3,oneof" json:"extra_low_values_counter,omitempty"` + ExtraHighValuesCounter *uint32 `protobuf:"varint,10,opt,name=extra_high_values_counter,json=extraHighValuesCounter,proto3,oneof" json:"extra_high_values_counter,omitempty"` // histogram parameter - value multiplier aka smallest value // default = 1.0 - MinResolution *float64 `protobuf:"fixed64,10,opt,name=min_resolution,json=minResolution,proto3,oneof" json:"min_resolution,omitempty"` + MinResolution *float64 `protobuf:"fixed64,11,opt,name=min_resolution,json=minResolution,proto3,oneof" json:"min_resolution,omitempty"` // histogram parameter - number of significant digits used to calculate buckets formula // default = 2 - SignificantDigits *uint32 `protobuf:"varint,11,opt,name=significant_digits,json=significantDigits,proto3,oneof" json:"significant_digits,omitempty"` + SignificantDigits *uint32 `protobuf:"varint,12,opt,name=significant_digits,json=significantDigits,proto3,oneof" json:"significant_digits,omitempty"` } func (x *TrendHdrValue) Reset() { *x = TrendHdrValue{} if protoimpl.UnsafeEnabled { - mi := &file_metric_proto_msgTypes[11] + mi := &file_metric_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -842,7 +900,7 @@ func (x *TrendHdrValue) String() string { func (*TrendHdrValue) ProtoMessage() {} func (x *TrendHdrValue) ProtoReflect() protoreflect.Message { - mi := &file_metric_proto_msgTypes[11] + mi := &file_metric_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -855,7 +913,7 @@ func (x *TrendHdrValue) ProtoReflect() protoreflect.Message { // Deprecated: Use TrendHdrValue.ProtoReflect.Descriptor instead. func (*TrendHdrValue) Descriptor() ([]byte, []int) { - return file_metric_proto_rawDescGZIP(), []int{11} + return file_metric_proto_rawDescGZIP(), []int{12} } func (x *TrendHdrValue) GetTime() *timestamppb.Timestamp { @@ -872,11 +930,11 @@ func (x *TrendHdrValue) GetCounters() []uint32 { return nil } -func (x *TrendHdrValue) GetLowerCounterIndex() uint32 { +func (x *TrendHdrValue) GetSpans() []*BucketSpan { if x != nil { - return x.LowerCounterIndex + return x.Spans } - return 0 + return nil } func (x *TrendHdrValue) GetSum() float64 { @@ -1020,54 +1078,58 @@ var file_metric_proto_rawDesc = []byte{ 0x6f, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6e, 0x6f, 0x6e, 0x7a, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xb0, 0x04, 0x0a, - 0x0d, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x48, 0x64, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2e, - 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x08, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x6c, 0x6f, - 0x77, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, - 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x18, - 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x6c, 0x6f, 0x77, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, - 0x52, 0x15, 0x65, 0x78, 0x74, 0x72, 0x61, 0x4c, 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x3e, 0x0a, 0x19, 0x65, 0x78, - 0x74, 0x72, 0x61, 0x5f, 0x68, 0x69, 0x67, 0x68, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x16, 0x65, 0x78, 0x74, 0x72, 0x61, 0x48, 0x69, 0x67, 0x68, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x0e, 0x6d, 0x69, - 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x01, 0x48, 0x02, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, - 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x32, 0x0a, 0x12, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x6e, 0x74, 0x5f, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x03, 0x52, 0x11, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, - 0x74, 0x44, 0x69, 0x67, 0x69, 0x74, 0x73, 0x88, 0x01, 0x01, 0x42, 0x1b, 0x0a, 0x19, 0x5f, 0x65, - 0x78, 0x74, 0x72, 0x61, 0x5f, 0x6c, 0x6f, 0x77, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x42, 0x1c, 0x0a, 0x1a, 0x5f, 0x65, 0x78, 0x74, 0x72, - 0x61, 0x5f, 0x68, 0x69, 0x67, 0x68, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x72, 0x65, - 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x73, 0x69, 0x67, - 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x5f, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x2a, - 0x86, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, - 0x0a, 0x17, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x4d, - 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x55, 0x4e, 0x54, - 0x45, 0x52, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x47, 0x41, 0x55, 0x47, 0x45, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x4d, - 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x41, 0x54, 0x45, 0x10, - 0x03, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x54, 0x52, 0x45, 0x4e, 0x44, 0x10, 0x04, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x6f, 0x2e, 0x6b, - 0x36, 0x2e, 0x69, 0x6f, 0x2f, 0x6b, 0x36, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x63, - 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x65, 0x78, 0x70, 0x76, 0x32, 0x2f, 0x70, 0x62, 0x63, 0x6c, 0x6f, - 0x75, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3c, 0x0a, 0x0a, + 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xab, 0x04, 0x0a, 0x0d, 0x54, + 0x72, 0x65, 0x6e, 0x64, 0x48, 0x64, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2e, 0x0a, 0x04, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x08, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x29, 0x0a, 0x05, 0x73, 0x70, 0x61, 0x6e, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x73, 0x2e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x05, 0x73, 0x70, + 0x61, 0x6e, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x03, 0x73, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6d, + 0x69, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, + 0x6d, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6d, 0x61, 0x78, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x18, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x6c, + 0x6f, 0x77, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x15, 0x65, 0x78, 0x74, 0x72, 0x61, + 0x4c, 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x88, 0x01, 0x01, 0x12, 0x3e, 0x0a, 0x19, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x68, 0x69, 0x67, + 0x68, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x16, 0x65, 0x78, 0x74, 0x72, 0x61, 0x48, + 0x69, 0x67, 0x68, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x0e, 0x6d, 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x48, 0x02, 0x52, 0x0d, 0x6d, + 0x69, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, + 0x32, 0x0a, 0x12, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x5f, 0x64, + 0x69, 0x67, 0x69, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x03, 0x52, 0x11, 0x73, + 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x44, 0x69, 0x67, 0x69, 0x74, 0x73, + 0x88, 0x01, 0x01, 0x42, 0x1b, 0x0a, 0x19, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x6c, 0x6f, + 0x77, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x42, 0x1c, 0x0a, 0x1a, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x68, 0x69, 0x67, 0x68, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x42, 0x11, + 0x0a, 0x0f, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, + 0x74, 0x5f, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x2a, 0x86, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x4d, 0x45, 0x54, 0x52, 0x49, + 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x15, 0x0a, + 0x11, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x41, 0x55, + 0x47, 0x45, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x52, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, + 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x45, 0x4e, 0x44, 0x10, + 0x04, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x6f, 0x2e, 0x6b, 0x36, 0x2e, 0x69, 0x6f, 0x2f, 0x6b, 0x36, + 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x65, 0x78, + 0x70, 0x76, 0x32, 0x2f, 0x70, 0x62, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1083,7 +1145,7 @@ func file_metric_proto_rawDescGZIP() []byte { } var file_metric_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_metric_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_metric_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_metric_proto_goTypes = []interface{}{ (MetricType)(0), // 0: metrics.MetricType (*MetricSet)(nil), // 1: metrics.MetricSet @@ -1097,8 +1159,9 @@ var file_metric_proto_goTypes = []interface{}{ (*CounterValue)(nil), // 9: metrics.CounterValue (*GaugeValue)(nil), // 10: metrics.GaugeValue (*RateValue)(nil), // 11: metrics.RateValue - (*TrendHdrValue)(nil), // 12: metrics.TrendHdrValue - (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp + (*BucketSpan)(nil), // 12: metrics.BucketSpan + (*TrendHdrValue)(nil), // 13: metrics.TrendHdrValue + (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp } var file_metric_proto_depIdxs = []int32{ 2, // 0: metrics.MetricSet.metrics:type_name -> metrics.Metric @@ -1112,16 +1175,17 @@ var file_metric_proto_depIdxs = []int32{ 9, // 8: metrics.CounterSamples.values:type_name -> metrics.CounterValue 10, // 9: metrics.GaugeSamples.values:type_name -> metrics.GaugeValue 11, // 10: metrics.RateSamples.values:type_name -> metrics.RateValue - 12, // 11: metrics.TrendHdrSamples.values:type_name -> metrics.TrendHdrValue - 13, // 12: metrics.CounterValue.time:type_name -> google.protobuf.Timestamp - 13, // 13: metrics.GaugeValue.time:type_name -> google.protobuf.Timestamp - 13, // 14: metrics.RateValue.time:type_name -> google.protobuf.Timestamp - 13, // 15: metrics.TrendHdrValue.time:type_name -> google.protobuf.Timestamp - 16, // [16:16] is the sub-list for method output_type - 16, // [16:16] is the sub-list for method input_type - 16, // [16:16] is the sub-list for extension type_name - 16, // [16:16] is the sub-list for extension extendee - 0, // [0:16] is the sub-list for field type_name + 13, // 11: metrics.TrendHdrSamples.values:type_name -> metrics.TrendHdrValue + 14, // 12: metrics.CounterValue.time:type_name -> google.protobuf.Timestamp + 14, // 13: metrics.GaugeValue.time:type_name -> google.protobuf.Timestamp + 14, // 14: metrics.RateValue.time:type_name -> google.protobuf.Timestamp + 14, // 15: metrics.TrendHdrValue.time:type_name -> google.protobuf.Timestamp + 12, // 16: metrics.TrendHdrValue.spans:type_name -> metrics.BucketSpan + 17, // [17:17] is the sub-list for method output_type + 17, // [17:17] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name } func init() { file_metric_proto_init() } @@ -1263,6 +1327,18 @@ func file_metric_proto_init() { } } file_metric_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BucketSpan); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_metric_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TrendHdrValue); i { case 0: return &v.state @@ -1281,14 +1357,14 @@ func file_metric_proto_init() { (*TimeSeries_RateSamples)(nil), (*TimeSeries_TrendHdrSamples)(nil), } - file_metric_proto_msgTypes[11].OneofWrappers = []interface{}{} + file_metric_proto_msgTypes[12].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_metric_proto_rawDesc, NumEnums: 1, - NumMessages: 12, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/output/cloud/expv2/pbcloud/metric.proto b/output/cloud/expv2/pbcloud/metric.proto index 6aefdc57db33..4e66cae57e3a 100644 --- a/output/cloud/expv2/pbcloud/metric.proto +++ b/output/cloud/expv2/pbcloud/metric.proto @@ -115,30 +115,40 @@ message RateValue { uint32 total_count = 3; } +// BucketSpan represents the consecutive and significant (non-zero) buckets. +// The concept is imported from the Prometheus' native histogram. +// It should simplify an eventual transition to Prometheus. +// https://github.com/prometheus/prometheus/blob/f399f386cef3b19c48157e9678a4f50997db3f41/prompb/io/prometheus/client/metrics.proto#L115-L124 +message BucketSpan { + uint32 offset = 1; // Gap to previous span, or starting point for 1st span. + uint32 length = 2; // Length of the next consecutive buckets. +} + message TrendHdrValue { // Required. google.protobuf.Timestamp time = 1; - // buckets + // positive buckets starting from bucket 1, each counter is an absolute value. repeated uint32 counters = 2; - // index of first bucket in `counters` - uint32 lower_counter_index = 3; + repeated BucketSpan spans = 3; + // sum of observations - double sum = 4; + double sum = 5; // count of observations - uint32 count = 5; + uint32 count = 6; // smallest and largest observed value - double min_value = 6; - double max_value = 7; + double min_value = 7; + double max_value = 8; - // counters for zero and infinity buckets - optional uint32 extra_low_values_counter = 8; - optional uint32 extra_high_values_counter = 9; + // counters for zero- and infinity-buckets + optional uint32 extra_low_values_counter = 9; + optional uint32 extra_high_values_counter = 10; // histogram parameter - value multiplier aka smallest value // default = 1.0 - optional double min_resolution = 10; + optional double min_resolution = 11; + // histogram parameter - number of significant digits used to calculate buckets formula // default = 2 - optional uint32 significant_digits = 11; + optional uint32 significant_digits = 12; }