diff --git a/aggregationpb/aggregation.pb.go b/aggregationpb/aggregation.pb.go index fc001ac..0a74387 100644 --- a/aggregationpb/aggregation.pb.go +++ b/aggregationpb/aggregation.pb.go @@ -1193,17 +1193,21 @@ func (x *SpanMetrics) GetSum() float64 { return 0 } -type CountValue struct { +type Overflow struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` + OverflowTransactions *TransactionMetrics `protobuf:"bytes,1,opt,name=overflow_transactions,json=overflowTransactions,proto3" json:"overflow_transactions,omitempty"` + OverflowServiceTransactions *ServiceTransactionMetrics `protobuf:"bytes,2,opt,name=overflow_service_transactions,json=overflowServiceTransactions,proto3" json:"overflow_service_transactions,omitempty"` + OverflowSpans *SpanMetrics `protobuf:"bytes,3,opt,name=overflow_spans,json=overflowSpans,proto3" json:"overflow_spans,omitempty"` + OverflowTransactionsEstimator []byte `protobuf:"bytes,4,opt,name=overflow_transactions_estimator,json=overflowTransactionsEstimator,proto3" json:"overflow_transactions_estimator,omitempty"` + OverflowServiceTransactionsEstimator []byte `protobuf:"bytes,5,opt,name=overflow_service_transactions_estimator,json=overflowServiceTransactionsEstimator,proto3" json:"overflow_service_transactions_estimator,omitempty"` + OverflowSpansEstimator []byte `protobuf:"bytes,6,opt,name=overflow_spans_estimator,json=overflowSpansEstimator,proto3" json:"overflow_spans_estimator,omitempty"` } -func (x *CountValue) Reset() { - *x = CountValue{} +func (x *Overflow) Reset() { + *x = Overflow{} if protoimpl.UnsafeEnabled { mi := &file_proto_aggregation_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1211,13 +1215,13 @@ func (x *CountValue) Reset() { } } -func (x *CountValue) String() string { +func (x *Overflow) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CountValue) ProtoMessage() {} +func (*Overflow) ProtoMessage() {} -func (x *CountValue) ProtoReflect() protoreflect.Message { +func (x *Overflow) ProtoReflect() protoreflect.Message { mi := &file_proto_aggregation_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1229,23 +1233,51 @@ func (x *CountValue) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CountValue.ProtoReflect.Descriptor instead. -func (*CountValue) Descriptor() ([]byte, []int) { +// Deprecated: Use Overflow.ProtoReflect.Descriptor instead. +func (*Overflow) Descriptor() ([]byte, []int) { return file_proto_aggregation_proto_rawDescGZIP(), []int{16} } -func (x *CountValue) GetCount() int64 { +func (x *Overflow) GetOverflowTransactions() *TransactionMetrics { if x != nil { - return x.Count + return x.OverflowTransactions } - return 0 + return nil } -func (x *CountValue) GetValue() int64 { +func (x *Overflow) GetOverflowServiceTransactions() *ServiceTransactionMetrics { if x != nil { - return x.Value + return x.OverflowServiceTransactions } - return 0 + return nil +} + +func (x *Overflow) GetOverflowSpans() *SpanMetrics { + if x != nil { + return x.OverflowSpans + } + return nil +} + +func (x *Overflow) GetOverflowTransactionsEstimator() []byte { + if x != nil { + return x.OverflowTransactionsEstimator + } + return nil +} + +func (x *Overflow) GetOverflowServiceTransactionsEstimator() []byte { + if x != nil { + return x.OverflowServiceTransactionsEstimator + } + return nil +} + +func (x *Overflow) GetOverflowSpansEstimator() []byte { + if x != nil { + return x.OverflowSpansEstimator + } + return nil } type HDRHistogram struct { @@ -1327,93 +1359,6 @@ func (x *HDRHistogram) GetBuckets() []int32 { return nil } -type Overflow struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - OverflowTransactions *TransactionMetrics `protobuf:"bytes,1,opt,name=overflow_transactions,json=overflowTransactions,proto3" json:"overflow_transactions,omitempty"` - OverflowServiceTransactions *ServiceTransactionMetrics `protobuf:"bytes,2,opt,name=overflow_service_transactions,json=overflowServiceTransactions,proto3" json:"overflow_service_transactions,omitempty"` - OverflowSpans *SpanMetrics `protobuf:"bytes,3,opt,name=overflow_spans,json=overflowSpans,proto3" json:"overflow_spans,omitempty"` - OverflowTransactionsEstimator []byte `protobuf:"bytes,4,opt,name=overflow_transactions_estimator,json=overflowTransactionsEstimator,proto3" json:"overflow_transactions_estimator,omitempty"` - OverflowServiceTransactionsEstimator []byte `protobuf:"bytes,5,opt,name=overflow_service_transactions_estimator,json=overflowServiceTransactionsEstimator,proto3" json:"overflow_service_transactions_estimator,omitempty"` - OverflowSpansEstimator []byte `protobuf:"bytes,6,opt,name=overflow_spans_estimator,json=overflowSpansEstimator,proto3" json:"overflow_spans_estimator,omitempty"` -} - -func (x *Overflow) Reset() { - *x = Overflow{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_aggregation_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Overflow) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Overflow) ProtoMessage() {} - -func (x *Overflow) ProtoReflect() protoreflect.Message { - mi := &file_proto_aggregation_proto_msgTypes[18] - 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 Overflow.ProtoReflect.Descriptor instead. -func (*Overflow) Descriptor() ([]byte, []int) { - return file_proto_aggregation_proto_rawDescGZIP(), []int{18} -} - -func (x *Overflow) GetOverflowTransactions() *TransactionMetrics { - if x != nil { - return x.OverflowTransactions - } - return nil -} - -func (x *Overflow) GetOverflowServiceTransactions() *ServiceTransactionMetrics { - if x != nil { - return x.OverflowServiceTransactions - } - return nil -} - -func (x *Overflow) GetOverflowSpans() *SpanMetrics { - if x != nil { - return x.OverflowSpans - } - return nil -} - -func (x *Overflow) GetOverflowTransactionsEstimator() []byte { - if x != nil { - return x.OverflowTransactionsEstimator - } - return nil -} - -func (x *Overflow) GetOverflowServiceTransactionsEstimator() []byte { - if x != nil { - return x.OverflowServiceTransactionsEstimator - } - return nil -} - -func (x *Overflow) GetOverflowSpansEstimator() []byte { - if x != nil { - return x.OverflowSpansEstimator - } - return nil -} - var File_proto_aggregation_proto protoreflect.FileDescriptor var file_proto_aggregation_proto_rawDesc = []byte{ @@ -1648,57 +1593,53 @@ var file_proto_aggregation_proto_rawDesc = []byte{ 0x35, 0x0a, 0x0b, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x22, 0x38, 0x0a, 0x0a, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0xdf, 0x01, 0x0a, 0x0c, 0x48, 0x44, 0x52, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, - 0x6d, 0x12, 0x34, 0x0a, 0x16, 0x6c, 0x6f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x63, - 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x14, 0x6c, 0x6f, 0x77, 0x65, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, - 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x68, 0x69, 0x67, 0x68, 0x65, - 0x73, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, - 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x2f, 0x0a, 0x13, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x5f, 0x66, - 0x69, 0x67, 0x75, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x73, 0x69, - 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x46, 0x69, 0x67, 0x75, 0x72, 0x65, 0x73, - 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, - 0x52, 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, - 0x65, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, - 0x74, 0x73, 0x22, 0xe6, 0x03, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x12, - 0x54, 0x0a, 0x15, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x54, 0x72, 0x61, - 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, - 0x14, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x6a, 0x0a, 0x1d, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, - 0x77, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, - 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x73, 0x52, 0x1b, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x3f, 0x0a, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x70, - 0x61, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x6c, 0x61, 0x73, - 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x52, 0x0d, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x70, 0x61, - 0x6e, 0x73, 0x12, 0x46, 0x0a, 0x1f, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x65, 0x73, 0x74, 0x69, - 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x1d, 0x6f, 0x76, 0x65, - 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x55, 0x0a, 0x27, 0x6f, 0x76, - 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x65, 0x73, 0x74, 0x69, - 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x24, 0x6f, 0x76, 0x65, - 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, - 0x72, 0x12, 0x38, 0x0a, 0x18, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x70, - 0x61, 0x6e, 0x73, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x16, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x70, 0x61, - 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x42, 0x13, 0x48, 0x01, 0x5a, - 0x0f, 0x2e, 0x2f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x22, 0xe6, 0x03, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x66, + 0x6c, 0x6f, 0x77, 0x12, 0x54, 0x0a, 0x15, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, + 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x73, 0x52, 0x14, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x6a, 0x0a, 0x1d, 0x6f, 0x76, 0x65, + 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x1b, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, + 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3f, 0x0a, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, + 0x77, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x70, 0x61, 0x6e, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x0d, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, + 0x77, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x12, 0x46, 0x0a, 0x1f, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, + 0x6f, 0x77, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, + 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x1d, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x55, + 0x0a, 0x27, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, + 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x24, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, + 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x18, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, + 0x77, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, + 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, + 0x77, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x22, + 0xdf, 0x01, 0x0a, 0x0c, 0x48, 0x44, 0x52, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, + 0x12, 0x34, 0x0a, 0x16, 0x6c, 0x6f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x14, 0x6c, 0x6f, 0x77, 0x65, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, + 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, + 0x74, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, + 0x54, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2f, + 0x0a, 0x13, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x5f, 0x66, 0x69, + 0x67, 0x75, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x73, 0x69, 0x67, + 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x46, 0x69, 0x67, 0x75, 0x72, 0x65, 0x73, 0x12, + 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, + 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, + 0x73, 0x42, 0x13, 0x48, 0x01, 0x5a, 0x0f, 0x2e, 0x2f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1713,7 +1654,7 @@ func file_proto_aggregation_proto_rawDescGZIP() []byte { return file_proto_aggregation_proto_rawDescData } -var file_proto_aggregation_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_proto_aggregation_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_proto_aggregation_proto_goTypes = []interface{}{ (*CombinedMetrics)(nil), // 0: elastic.apm.CombinedMetrics (*KeyedServiceMetrics)(nil), // 1: elastic.apm.KeyedServiceMetrics @@ -1731,17 +1672,16 @@ var file_proto_aggregation_proto_goTypes = []interface{}{ (*KeyedSpanMetrics)(nil), // 13: elastic.apm.KeyedSpanMetrics (*SpanAggregationKey)(nil), // 14: elastic.apm.SpanAggregationKey (*SpanMetrics)(nil), // 15: elastic.apm.SpanMetrics - (*CountValue)(nil), // 16: elastic.apm.CountValue + (*Overflow)(nil), // 16: elastic.apm.Overflow (*HDRHistogram)(nil), // 17: elastic.apm.HDRHistogram - (*Overflow)(nil), // 18: elastic.apm.Overflow } var file_proto_aggregation_proto_depIdxs = []int32{ 1, // 0: elastic.apm.CombinedMetrics.service_metrics:type_name -> elastic.apm.KeyedServiceMetrics - 18, // 1: elastic.apm.CombinedMetrics.overflow_services:type_name -> elastic.apm.Overflow + 16, // 1: elastic.apm.CombinedMetrics.overflow_services:type_name -> elastic.apm.Overflow 2, // 2: elastic.apm.KeyedServiceMetrics.key:type_name -> elastic.apm.ServiceAggregationKey 3, // 3: elastic.apm.KeyedServiceMetrics.metrics:type_name -> elastic.apm.ServiceMetrics 6, // 4: elastic.apm.ServiceMetrics.service_instance_metrics:type_name -> elastic.apm.KeyedServiceInstanceMetrics - 18, // 5: elastic.apm.ServiceMetrics.overflow_groups:type_name -> elastic.apm.Overflow + 16, // 5: elastic.apm.ServiceMetrics.overflow_groups:type_name -> elastic.apm.Overflow 7, // 6: elastic.apm.ServiceInstanceMetrics.transaction_metrics:type_name -> elastic.apm.KeyedTransactionMetrics 10, // 7: elastic.apm.ServiceInstanceMetrics.service_transaction_metrics:type_name -> elastic.apm.KeyedServiceTransactionMetrics 13, // 8: elastic.apm.ServiceInstanceMetrics.span_metrics:type_name -> elastic.apm.KeyedSpanMetrics @@ -1964,7 +1904,7 @@ func file_proto_aggregation_proto_init() { } } file_proto_aggregation_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CountValue); i { + switch v := v.(*Overflow); i { case 0: return &v.state case 1: @@ -1987,18 +1927,6 @@ func file_proto_aggregation_proto_init() { return nil } } - file_proto_aggregation_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Overflow); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2006,7 +1934,7 @@ func file_proto_aggregation_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_aggregation_proto_rawDesc, NumEnums: 0, - NumMessages: 19, + NumMessages: 18, NumExtensions: 0, NumServices: 0, }, diff --git a/aggregationpb/aggregation_vtproto.pb.go b/aggregationpb/aggregation_vtproto.pb.go index c93f8dc..70c8565 100644 --- a/aggregationpb/aggregation_vtproto.pb.go +++ b/aggregationpb/aggregation_vtproto.pb.go @@ -407,13 +407,29 @@ func (m *SpanMetrics) CloneMessageVT() proto.Message { return m.CloneVT() } -func (m *CountValue) CloneVT() *CountValue { +func (m *Overflow) CloneVT() *Overflow { if m == nil { - return (*CountValue)(nil) + return (*Overflow)(nil) } - r := &CountValue{ - Count: m.Count, - Value: m.Value, + r := &Overflow{ + OverflowTransactions: m.OverflowTransactions.CloneVT(), + OverflowServiceTransactions: m.OverflowServiceTransactions.CloneVT(), + OverflowSpans: m.OverflowSpans.CloneVT(), + } + if rhs := m.OverflowTransactionsEstimator; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.OverflowTransactionsEstimator = tmpBytes + } + if rhs := m.OverflowServiceTransactionsEstimator; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.OverflowServiceTransactionsEstimator = tmpBytes + } + if rhs := m.OverflowSpansEstimator; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.OverflowSpansEstimator = tmpBytes } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) @@ -422,7 +438,7 @@ func (m *CountValue) CloneVT() *CountValue { return r } -func (m *CountValue) CloneMessageVT() proto.Message { +func (m *Overflow) CloneMessageVT() proto.Message { return m.CloneVT() } @@ -456,41 +472,6 @@ func (m *HDRHistogram) CloneMessageVT() proto.Message { return m.CloneVT() } -func (m *Overflow) CloneVT() *Overflow { - if m == nil { - return (*Overflow)(nil) - } - r := &Overflow{ - OverflowTransactions: m.OverflowTransactions.CloneVT(), - OverflowServiceTransactions: m.OverflowServiceTransactions.CloneVT(), - OverflowSpans: m.OverflowSpans.CloneVT(), - } - if rhs := m.OverflowTransactionsEstimator; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.OverflowTransactionsEstimator = tmpBytes - } - if rhs := m.OverflowServiceTransactionsEstimator; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.OverflowServiceTransactionsEstimator = tmpBytes - } - if rhs := m.OverflowSpansEstimator; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.OverflowSpansEstimator = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Overflow) CloneMessageVT() proto.Message { - return m.CloneVT() -} - func (m *CombinedMetrics) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -1582,7 +1563,7 @@ func (m *SpanMetrics) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *CountValue) MarshalVT() (dAtA []byte, err error) { +func (m *Overflow) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -1595,12 +1576,12 @@ func (m *CountValue) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CountValue) MarshalToVT(dAtA []byte) (int, error) { +func (m *Overflow) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *CountValue) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *Overflow) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -1612,15 +1593,56 @@ func (m *CountValue) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if m.Value != 0 { - i = encodeVarint(dAtA, i, uint64(m.Value)) + if len(m.OverflowSpansEstimator) > 0 { + i -= len(m.OverflowSpansEstimator) + copy(dAtA[i:], m.OverflowSpansEstimator) + i = encodeVarint(dAtA, i, uint64(len(m.OverflowSpansEstimator))) + i-- + dAtA[i] = 0x32 + } + if len(m.OverflowServiceTransactionsEstimator) > 0 { + i -= len(m.OverflowServiceTransactionsEstimator) + copy(dAtA[i:], m.OverflowServiceTransactionsEstimator) + i = encodeVarint(dAtA, i, uint64(len(m.OverflowServiceTransactionsEstimator))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x2a } - if m.Count != 0 { - i = encodeVarint(dAtA, i, uint64(m.Count)) + if len(m.OverflowTransactionsEstimator) > 0 { + i -= len(m.OverflowTransactionsEstimator) + copy(dAtA[i:], m.OverflowTransactionsEstimator) + i = encodeVarint(dAtA, i, uint64(len(m.OverflowTransactionsEstimator))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0x22 + } + if m.OverflowSpans != nil { + size, err := m.OverflowSpans.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if m.OverflowServiceTransactions != nil { + size, err := m.OverflowServiceTransactions.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.OverflowTransactions != nil { + size, err := m.OverflowTransactions.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1715,90 +1737,6 @@ func (m *HDRHistogram) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Overflow) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Overflow) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Overflow) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.OverflowSpansEstimator) > 0 { - i -= len(m.OverflowSpansEstimator) - copy(dAtA[i:], m.OverflowSpansEstimator) - i = encodeVarint(dAtA, i, uint64(len(m.OverflowSpansEstimator))) - i-- - dAtA[i] = 0x32 - } - if len(m.OverflowServiceTransactionsEstimator) > 0 { - i -= len(m.OverflowServiceTransactionsEstimator) - copy(dAtA[i:], m.OverflowServiceTransactionsEstimator) - i = encodeVarint(dAtA, i, uint64(len(m.OverflowServiceTransactionsEstimator))) - i-- - dAtA[i] = 0x2a - } - if len(m.OverflowTransactionsEstimator) > 0 { - i -= len(m.OverflowTransactionsEstimator) - copy(dAtA[i:], m.OverflowTransactionsEstimator) - i = encodeVarint(dAtA, i, uint64(len(m.OverflowTransactionsEstimator))) - i-- - dAtA[i] = 0x22 - } - if m.OverflowSpans != nil { - size, err := m.OverflowSpans.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.OverflowServiceTransactions != nil { - size, err := m.OverflowServiceTransactions.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.OverflowTransactions != nil { - size, err := m.OverflowTransactions.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarint(dAtA []byte, offset int, v uint64) int { offset -= sov(v) base := offset @@ -2165,23 +2103,32 @@ func SpanMetricsFromVTPool() *SpanMetrics { return vtprotoPool_SpanMetrics.Get().(*SpanMetrics) } -var vtprotoPool_CountValue = sync.Pool{ +var vtprotoPool_Overflow = sync.Pool{ New: func() interface{} { - return &CountValue{} + return &Overflow{} }, } -func (m *CountValue) ResetVT() { +func (m *Overflow) ResetVT() { + m.OverflowTransactions.ReturnToVTPool() + m.OverflowServiceTransactions.ReturnToVTPool() + m.OverflowSpans.ReturnToVTPool() + f0 := m.OverflowTransactionsEstimator[:0] + f1 := m.OverflowServiceTransactionsEstimator[:0] + f2 := m.OverflowSpansEstimator[:0] m.Reset() + m.OverflowTransactionsEstimator = f0 + m.OverflowServiceTransactionsEstimator = f1 + m.OverflowSpansEstimator = f2 } -func (m *CountValue) ReturnToVTPool() { +func (m *Overflow) ReturnToVTPool() { if m != nil { m.ResetVT() - vtprotoPool_CountValue.Put(m) + vtprotoPool_Overflow.Put(m) } } -func CountValueFromVTPool() *CountValue { - return vtprotoPool_CountValue.Get().(*CountValue) +func OverflowFromVTPool() *Overflow { + return vtprotoPool_Overflow.Get().(*Overflow) } var vtprotoPool_HDRHistogram = sync.Pool{ @@ -2206,34 +2153,6 @@ func (m *HDRHistogram) ReturnToVTPool() { func HDRHistogramFromVTPool() *HDRHistogram { return vtprotoPool_HDRHistogram.Get().(*HDRHistogram) } - -var vtprotoPool_Overflow = sync.Pool{ - New: func() interface{} { - return &Overflow{} - }, -} - -func (m *Overflow) ResetVT() { - m.OverflowTransactions.ReturnToVTPool() - m.OverflowServiceTransactions.ReturnToVTPool() - m.OverflowSpans.ReturnToVTPool() - f0 := m.OverflowTransactionsEstimator[:0] - f1 := m.OverflowServiceTransactionsEstimator[:0] - f2 := m.OverflowSpansEstimator[:0] - m.Reset() - m.OverflowTransactionsEstimator = f0 - m.OverflowServiceTransactionsEstimator = f1 - m.OverflowSpansEstimator = f2 -} -func (m *Overflow) ReturnToVTPool() { - if m != nil { - m.ResetVT() - vtprotoPool_Overflow.Put(m) - } -} -func OverflowFromVTPool() *Overflow { - return vtprotoPool_Overflow.Get().(*Overflow) -} func (m *CombinedMetrics) SizeVT() (n int) { if m == nil { return 0 @@ -2667,27 +2586,45 @@ func (m *SpanMetrics) SizeVT() (n int) { return n } -func (m *CountValue) SizeVT() (n int) { +func (m *Overflow) SizeVT() (n int) { if m == nil { return 0 } var l int _ = l - if m.Count != 0 { - n += 1 + sov(uint64(m.Count)) - } - if m.Value != 0 { - n += 1 + sov(uint64(m.Value)) + if m.OverflowTransactions != nil { + l = m.OverflowTransactions.SizeVT() + n += 1 + l + sov(uint64(l)) } - n += len(m.unknownFields) - return n -} - -func (m *HDRHistogram) SizeVT() (n int) { - if m == nil { - return 0 + if m.OverflowServiceTransactions != nil { + l = m.OverflowServiceTransactions.SizeVT() + n += 1 + l + sov(uint64(l)) } - var l int + if m.OverflowSpans != nil { + l = m.OverflowSpans.SizeVT() + n += 1 + l + sov(uint64(l)) + } + l = len(m.OverflowTransactionsEstimator) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.OverflowServiceTransactionsEstimator) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.OverflowSpansEstimator) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *HDRHistogram) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int _ = l if m.LowestTrackableValue != 0 { n += 1 + sov(uint64(m.LowestTrackableValue)) @@ -2716,40 +2653,6 @@ func (m *HDRHistogram) SizeVT() (n int) { return n } -func (m *Overflow) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OverflowTransactions != nil { - l = m.OverflowTransactions.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.OverflowServiceTransactions != nil { - l = m.OverflowServiceTransactions.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.OverflowSpans != nil { - l = m.OverflowSpans.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.OverflowTransactionsEstimator) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.OverflowServiceTransactionsEstimator) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.OverflowSpansEstimator) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - func sov(x uint64) (n int) { return (bits.Len64(x|1) + 6) / 7 } @@ -5699,7 +5602,7 @@ func (m *SpanMetrics) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *CountValue) UnmarshalVT(dAtA []byte) error { +func (m *Overflow) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5722,17 +5625,17 @@ func (m *CountValue) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CountValue: wiretype end group for non-group") + return fmt.Errorf("proto: Overflow: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CountValue: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Overflow: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OverflowTransactions", wireType) } - m.Count = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5742,16 +5645,33 @@ func (m *CountValue) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Count |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OverflowTransactions == nil { + m.OverflowTransactions = TransactionMetricsFromVTPool() + } + if err := m.OverflowTransactions.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OverflowServiceTransactions", wireType) } - m.Value = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5761,11 +5681,166 @@ func (m *CountValue) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Value |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OverflowServiceTransactions == nil { + m.OverflowServiceTransactions = ServiceTransactionMetricsFromVTPool() + } + if err := m.OverflowServiceTransactions.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OverflowSpans", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OverflowSpans == nil { + m.OverflowSpans = SpanMetricsFromVTPool() + } + if err := m.OverflowSpans.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OverflowTransactionsEstimator", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OverflowTransactionsEstimator = append(m.OverflowTransactionsEstimator[:0], dAtA[iNdEx:postIndex]...) + if m.OverflowTransactionsEstimator == nil { + m.OverflowTransactionsEstimator = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OverflowServiceTransactionsEstimator", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OverflowServiceTransactionsEstimator = append(m.OverflowServiceTransactionsEstimator[:0], dAtA[iNdEx:postIndex]...) + if m.OverflowServiceTransactionsEstimator == nil { + m.OverflowServiceTransactionsEstimator = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OverflowSpansEstimator", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OverflowSpansEstimator = append(m.OverflowSpansEstimator[:0], dAtA[iNdEx:postIndex]...) + if m.OverflowSpansEstimator == nil { + m.OverflowSpansEstimator = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -6048,267 +6123,6 @@ func (m *HDRHistogram) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Overflow) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Overflow: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Overflow: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OverflowTransactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OverflowTransactions == nil { - m.OverflowTransactions = TransactionMetricsFromVTPool() - } - if err := m.OverflowTransactions.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OverflowServiceTransactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OverflowServiceTransactions == nil { - m.OverflowServiceTransactions = ServiceTransactionMetricsFromVTPool() - } - if err := m.OverflowServiceTransactions.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OverflowSpans", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OverflowSpans == nil { - m.OverflowSpans = SpanMetricsFromVTPool() - } - if err := m.OverflowSpans.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OverflowTransactionsEstimator", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OverflowTransactionsEstimator = append(m.OverflowTransactionsEstimator[:0], dAtA[iNdEx:postIndex]...) - if m.OverflowTransactionsEstimator == nil { - m.OverflowTransactionsEstimator = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OverflowServiceTransactionsEstimator", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OverflowServiceTransactionsEstimator = append(m.OverflowServiceTransactionsEstimator[:0], dAtA[iNdEx:postIndex]...) - if m.OverflowServiceTransactionsEstimator == nil { - m.OverflowServiceTransactionsEstimator = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OverflowSpansEstimator", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OverflowSpansEstimator = append(m.OverflowSpansEstimator[:0], dAtA[iNdEx:postIndex]...) - if m.OverflowSpansEstimator == nil { - m.OverflowSpansEstimator = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skip(dAtA []byte) (n int, err error) { l := len(dAtA) diff --git a/aggregators/codec.go b/aggregators/codec.go index e1e81ba..2b1d345 100644 --- a/aggregators/codec.go +++ b/aggregators/codec.go @@ -427,9 +427,7 @@ func histogramFromProto(h *hdrhistogram.HistogramRepresentation, pb *aggregation h.CountsRep.Reset() for i := 0; i < len(pb.Buckets); i++ { - bucket := pb.Buckets[i] - counts := pb.Counts[i] - h.CountsRep.Add(bucket, counts) + h.CountsRep.Add(pb.Buckets[i], pb.Counts[i]) } } @@ -455,9 +453,9 @@ func setHistogramProto(h *hdrhistogram.HistogramRepresentation, pb *aggregationp if countsLen > cap(pb.Counts) { pb.Counts = make([]int64, 0, countsLen) } - h.CountsRep.ForEach(func(bucket int32, value int64) { + h.CountsRep.ForEach(func(bucket int32, count int64) { pb.Buckets = append(pb.Buckets, bucket) - pb.Counts = append(pb.Counts, value) + pb.Counts = append(pb.Counts, count) }) } diff --git a/aggregators/internal/hdrhistogram/hdrhistogram.go b/aggregators/internal/hdrhistogram/hdrhistogram.go index b277134..7f91f94 100644 --- a/aggregators/internal/hdrhistogram/hdrhistogram.go +++ b/aggregators/internal/hdrhistogram/hdrhistogram.go @@ -33,6 +33,8 @@ import ( "math" "math/bits" "time" + + "golang.org/x/exp/slices" ) const ( @@ -120,24 +122,21 @@ func (h *HistogramRepresentation) Buckets() (int64, []int64, []float64) { values := make([]float64, 0, h.CountsRep.Len()) var totalCount int64 - var bucketsSeen int + var prevBucket int32 iter := h.iterator() - // TODO @lahsivjar: Assuming sparse representation, we might be better off - // by sorting CountsRep rather than what we do now to avoid sorting. - for idx := 0; iter.next(); idx++ { - if bucketsSeen == h.CountsRep.Len() { - break + iter.nextCountAtIdx() + h.CountsRep.ForEach(func(bucket int32, scaledCounts int64) { + if scaledCounts <= 0 { + return } - scaledCount, ok := h.CountsRep.Get(int32(idx)) - if !ok || scaledCount <= 0 { - continue + if iter.advance(int(bucket - prevBucket)) { + count := int64(math.Round(float64(scaledCounts) / histogramCountScale)) + counts = append(counts, count) + values = append(values, float64(iter.highestEquivalentValue)) + totalCount += count } - bucketsSeen++ - count := int64(math.Round(float64(scaledCount) / histogramCountScale)) - counts = append(counts, count) - values = append(values, float64(iter.highestEquivalentValue)) - totalCount += count - } + prevBucket = bucket + }) return totalCount, counts, values } @@ -203,9 +202,12 @@ type iterator struct { highestEquivalentValue int64 } -func (i *iterator) next() bool { - if !i.nextCountAtIdx() { - return false +// advance advances the iterator by count +func (i *iterator) advance(count int) bool { + for c := 0; c < count; c++ { + if !i.nextCountAtIdx() { + return false + } } i.highestEquivalentValue = i.h.highestEquivalentValue(i.valueFromIdx) return true @@ -280,46 +282,59 @@ func getBucketCount() int32 { return bucketsNeeded } +// bar represents a bar of histogram. Each bar has a bucket, representing +// where the bar belongs to in the histogram range, and the count of values +// in each bucket. +type bar struct { + Bucket int32 + Count int64 +} + // HybridCountsRep represents a hybrid counts representation for // sparse histogram. It is optimized to record a single value as // integer type and more values as map. type HybridCountsRep struct { bucket int32 value int64 - m map[int32]int64 + s []bar } // Add adds a new value to a bucket of given index. func (c *HybridCountsRep) Add(bucket int32, value int64) { - if c.m == nil && c.bucket == 0 && c.value == 0 { + if c.s == nil && c.bucket == 0 && c.value == 0 { c.bucket = bucket c.value = value return } - if c.m == nil { - c.m = make(map[int32]int64) - // automatic promotion to map - c.m[c.bucket] = c.value + if c.s == nil { + // automatic promotion to slice + c.s = make([]bar, 0, 128) // TODO: Use pool + c.s = slices.Insert(c.s, 0, bar{Bucket: c.bucket, Count: c.value}) c.bucket, c.value = 0, 0 } - c.m[bucket] += value + at, found := slices.BinarySearchFunc(c.s, bar{Bucket: bucket}, compareBar) + if found { + c.s[at].Count += value + return + } + c.s = slices.Insert(c.s, at, bar{Bucket: bucket, Count: value}) } // ForEach iterates over each bucket and calls the given function. func (c *HybridCountsRep) ForEach(f func(int32, int64)) { - if c.m == nil && (c.bucket != 0 || c.value != 0) { + if c.s == nil && (c.bucket != 0 || c.value != 0) { f(c.bucket, c.value) return } - for k, v := range c.m { - f(k, v) + for i := range c.s { + f(c.s[i].Bucket, c.s[i].Count) } } // Len returns the number of buckets currently recording. func (c *HybridCountsRep) Len() int { - if c.m != nil { - return len(c.m) + if c.s != nil { + return len(c.s) } if c.bucket != 0 || c.value != 0 { return 1 @@ -330,23 +345,24 @@ func (c *HybridCountsRep) Len() int { // Get returns the count of values in a given bucket along with a bool // which is false if the bucket is not found. func (c *HybridCountsRep) Get(bucket int32) (int64, bool) { - if c.m == nil { + if c.s == nil { if c.bucket == bucket { return c.value, true } return 0, false } - val, ok := c.m[bucket] - return val, ok + at, found := slices.BinarySearchFunc(c.s, bar{Bucket: bucket}, compareBar) + if found { + return c.s[at].Count, true + } + return 0, false } // Reset resets the values recorded. func (c *HybridCountsRep) Reset() { c.bucket = 0 c.value = 0 - for k := range c.m { - delete(c.m, k) - } + c.s = c.s[:0] } // Equal returns true if same bucket and count is recorded in both. @@ -366,3 +382,13 @@ func (c *HybridCountsRep) Equal(h *HybridCountsRep) bool { }) return equal } + +func compareBar(a, b bar) int { + if a.Bucket == b.Bucket { + return 0 + } + if a.Bucket > b.Bucket { + return 1 + } + return -1 +} diff --git a/aggregators/merger.go b/aggregators/merger.go index 3f76f7e..98224f0 100644 --- a/aggregators/merger.go +++ b/aggregators/merger.go @@ -6,9 +6,9 @@ package aggregators import ( "io" - "sync" "github.com/axiomhq/hyperloglog" + "golang.org/x/exp/slices" "github.com/elastic/apm-aggregation/aggregationpb" ) @@ -407,39 +407,68 @@ func mergeSpanMetrics(to, from *aggregationpb.SpanMetrics) { to.Sum += from.Sum } -// mapPool is a pool of maps to facilitate histogram merges. -var mapPool = sync.Pool{New: func() interface{} { - return make(map[int32]int64) -}} - +// mergeHistogram merges two proto representation of HDRHistogram. The +// merge assumes both histograms are created with same arguments and +// their representations are sorted by bucket. func mergeHistogram(to, from *aggregationpb.HDRHistogram) { - // Assume both histograms are created with same arguments - m := mapPool.Get().(map[int32]int64) - defer mapPool.Put(m) - for k := range m { - delete(m, k) + if len(from.Buckets) == 0 { + return } - for i := 0; i < len(to.Buckets); i++ { - m[to.Buckets[i]] = to.Counts[i] - } - for i := 0; i < len(from.Buckets); i++ { - m[from.Buckets[i]] += from.Counts[i] + if len(to.Buckets) == 0 { + to.Buckets = append(to.Buckets, from.Buckets...) + to.Counts = append(to.Counts, from.Counts...) + return } - if cap(to.Buckets) < len(m) { - to.Buckets = make([]int32, len(m)) - } - if cap(to.Counts) < len(m) { - to.Counts = make([]int64, len(m)) + requiredLen := len(to.Buckets) + len(from.Buckets) + for toIdx, fromIdx := 0, 0; toIdx < len(to.Buckets) && fromIdx < len(from.Buckets); { + v := to.Buckets[toIdx] - from.Buckets[fromIdx] + switch { + case v == 0: + // For every bucket that is common, we need one less bucket in final slice + requiredLen-- + toIdx++ + fromIdx++ + case v < 0: + toIdx++ + case v > 0: + fromIdx++ + } } - to.Buckets = to.Buckets[:0] - to.Counts = to.Counts[:0] - - for b, c := range m { - to.Buckets = append(to.Buckets, b) - to.Counts = append(to.Counts, c) + toIdx, fromIdx := len(to.Buckets)-1, len(from.Buckets)-1 + to.Buckets = slices.Grow(to.Buckets, requiredLen) + to.Counts = slices.Grow(to.Counts, requiredLen) + to.Buckets = to.Buckets[:requiredLen] + to.Counts = to.Counts[:requiredLen] + for idx := len(to.Buckets) - 1; idx >= 0; idx-- { + if fromIdx < 0 { + break + } + if toIdx < 0 { + to.Counts[idx] = from.Counts[fromIdx] + to.Buckets[idx] = from.Buckets[fromIdx] + fromIdx-- + continue + } + v := to.Buckets[toIdx] - from.Buckets[fromIdx] + switch { + case v == 0: + to.Counts[toIdx] += from.Counts[fromIdx] + to.Counts[idx] = to.Counts[toIdx] + to.Buckets[idx] = to.Buckets[toIdx] + toIdx-- + fromIdx-- + case v > 0: + to.Counts[idx] = to.Counts[toIdx] + to.Buckets[idx] = to.Buckets[toIdx] + toIdx-- + case v < 0: + to.Counts[idx] = from.Counts[fromIdx] + to.Buckets[idx] = from.Buckets[fromIdx] + fromIdx-- + } } } diff --git a/aggregators/merger_test.go b/aggregators/merger_test.go index 686e759..7a9008c 100644 --- a/aggregators/merger_test.go +++ b/aggregators/merger_test.go @@ -999,26 +999,66 @@ func TestCardinalityEstimationOnSubKeyCollision(t *testing.T) { } func TestMergeHistogram(t *testing.T) { - // Test assumes histogram representation Merge is correct - hist1, hist2 := hdrhistogram.New(), hdrhistogram.New() - - for i := 0; i < 1_000_000; i++ { - v1, v2 := rand.Int63n(3_600_000_000), rand.Int63n(3_600_000_000) - c1, c2 := rand.Int63n(1_000), rand.Int63n(1_000) - hist1.RecordValues(v1, c1) - hist2.RecordValues(v2, c2) - } + for _, tc := range []struct { + name string + recordFunc func(h1, h2 *hdrhistogram.HistogramRepresentation) + }{ + { + name: "zero_values", + recordFunc: func(h1, h2 *hdrhistogram.HistogramRepresentation) { + h1.RecordValues(0, 0) + h2.RecordValues(0, 0) + }, + }, + { + name: "random_only_to", + recordFunc: func(h1, h2 *hdrhistogram.HistogramRepresentation) { + for i := 0; i < 1_000_000; i++ { + v := rand.Int63n(3_600_000_000) + c := rand.Int63n(1_000) + h1.RecordValues(v, c) + } + }, + }, + { + name: "random_only_from", + recordFunc: func(h1, h2 *hdrhistogram.HistogramRepresentation) { + for i := 0; i < 1_000_000; i++ { + v := rand.Int63n(3_600_000_000) + c := rand.Int63n(1_000) + h2.RecordValues(v, c) + } + }, + }, + { + name: "random_both", + recordFunc: func(h1, h2 *hdrhistogram.HistogramRepresentation) { + for i := 0; i < 1_000_000; i++ { + v1, v2 := rand.Int63n(3_600_000_000), rand.Int63n(3_600_000_000) + c1, c2 := rand.Int63n(1_000), rand.Int63n(1_000) + h1.RecordValues(v1, c1) + h2.RecordValues(v2, c2) + } + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + // Test assumes histogram representation Merge is correct + hist1, hist2 := hdrhistogram.New(), hdrhistogram.New() - histproto1, histproto2 := histogramToProto(hist1), histogramToProto(hist2) - hist1.Merge(hist2) - mergeHistogram(histproto1, histproto2) - histActual := hdrhistogram.New() - histogramFromProto(histActual, histproto1) + tc.recordFunc(hist1, hist2) + histproto1, histproto2 := histogramToProto(hist1), histogramToProto(hist2) + hist1.Merge(hist2) + mergeHistogram(histproto1, histproto2) + histActual := hdrhistogram.New() + histogramFromProto(histActual, histproto1) - assert.Empty(t, cmp.Diff( - hist1, - histActual, - cmp.AllowUnexported(hdrhistogram.HistogramRepresentation{}), - cmp.AllowUnexported(hdrhistogram.HybridCountsRep{}), - )) + assert.Empty(t, cmp.Diff( + hist1, + histActual, + cmp.AllowUnexported(hdrhistogram.HistogramRepresentation{}), + cmp.AllowUnexported(hdrhistogram.HybridCountsRep{}), + )) + }) + } } diff --git a/go.mod b/go.mod index 19f5556..e3d9d57 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/otel/trace v1.16.0 go.uber.org/zap v1.24.0 + golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 golang.org/x/sync v0.3.0 google.golang.org/protobuf v1.31.0 ) @@ -55,7 +56,6 @@ require ( go.elastic.co/fastjson v1.3.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect howett.net/plist v1.0.0 // indirect diff --git a/proto/aggregation.proto b/proto/aggregation.proto index 7e616cd..f6b2646 100644 --- a/proto/aggregation.proto +++ b/proto/aggregation.proto @@ -131,9 +131,13 @@ message SpanMetrics { double sum = 2; } -message CountValue { - int64 count = 1; - int64 value = 2; +message Overflow { + TransactionMetrics overflow_transactions = 1; + ServiceTransactionMetrics overflow_service_transactions = 2; + SpanMetrics overflow_spans = 3; + bytes overflow_transactions_estimator = 4; + bytes overflow_service_transactions_estimator = 5; + bytes overflow_spans_estimator = 6; } message HDRHistogram { @@ -144,11 +148,3 @@ message HDRHistogram { repeated int32 buckets = 5; } -message Overflow { - TransactionMetrics overflow_transactions = 1; - ServiceTransactionMetrics overflow_service_transactions = 2; - SpanMetrics overflow_spans = 3; - bytes overflow_transactions_estimator = 4; - bytes overflow_service_transactions_estimator = 5; - bytes overflow_spans_estimator = 6; -}