diff --git a/model/modelpb/batch.pb.go b/model/modelpb/batch.pb.go new file mode 100644 index 00000000..d085bb45 --- /dev/null +++ b/model/modelpb/batch.pb.go @@ -0,0 +1,167 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.24.3 +// source: batch.proto + +package modelpb + +import ( + reflect "reflect" + sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type APMBatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Events []*APMEvent `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` +} + +func (x *APMBatch) Reset() { + *x = APMBatch{} + if protoimpl.UnsafeEnabled { + mi := &file_batch_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *APMBatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*APMBatch) ProtoMessage() {} + +func (x *APMBatch) ProtoReflect() protoreflect.Message { + mi := &file_batch_proto_msgTypes[0] + 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 APMBatch.ProtoReflect.Descriptor instead. +func (*APMBatch) Descriptor() ([]byte, []int) { + return file_batch_proto_rawDescGZIP(), []int{0} +} + +func (x *APMBatch) GetEvents() []*APMEvent { + if x != nil { + return x.Events + } + return nil +} + +var File_batch_proto protoreflect.FileDescriptor + +var file_batch_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x65, + 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x76, 0x31, 0x1a, 0x0e, 0x61, + 0x70, 0x6d, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3c, 0x0a, + 0x08, 0x41, 0x50, 0x4d, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x06, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x6c, 0x61, 0x73, + 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x50, 0x4d, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x2b, 0x5a, 0x29, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, + 0x63, 0x2f, 0x61, 0x70, 0x6d, 0x2d, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_batch_proto_rawDescOnce sync.Once + file_batch_proto_rawDescData = file_batch_proto_rawDesc +) + +func file_batch_proto_rawDescGZIP() []byte { + file_batch_proto_rawDescOnce.Do(func() { + file_batch_proto_rawDescData = protoimpl.X.CompressGZIP(file_batch_proto_rawDescData) + }) + return file_batch_proto_rawDescData +} + +var file_batch_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_batch_proto_goTypes = []interface{}{ + (*APMBatch)(nil), // 0: elastic.apm.v1.APMBatch + (*APMEvent)(nil), // 1: elastic.apm.v1.APMEvent +} +var file_batch_proto_depIdxs = []int32{ + 1, // 0: elastic.apm.v1.APMBatch.events:type_name -> elastic.apm.v1.APMEvent + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_batch_proto_init() } +func file_batch_proto_init() { + if File_batch_proto != nil { + return + } + file_apmevent_proto_init() + if !protoimpl.UnsafeEnabled { + file_batch_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*APMBatch); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_batch_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_batch_proto_goTypes, + DependencyIndexes: file_batch_proto_depIdxs, + MessageInfos: file_batch_proto_msgTypes, + }.Build() + File_batch_proto = out.File + file_batch_proto_rawDesc = nil + file_batch_proto_goTypes = nil + file_batch_proto_depIdxs = nil +} diff --git a/model/modelpb/batch_vtproto.pb.go b/model/modelpb/batch_vtproto.pb.go new file mode 100644 index 00000000..f5704ae6 --- /dev/null +++ b/model/modelpb/batch_vtproto.pb.go @@ -0,0 +1,240 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.5.1-0.20230920154146-d6fc6ac3381e +// source: batch.proto + +package modelpb + +import ( + fmt "fmt" + io "io" + sync "sync" + + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *APMBatch) CloneVT() *APMBatch { + if m == nil { + return (*APMBatch)(nil) + } + r := APMBatchFromVTPool() + if rhs := m.Events; rhs != nil { + tmpContainer := make([]*APMEvent, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Events = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *APMBatch) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *APMBatch) 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 *APMBatch) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *APMBatch) 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.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Events[iNdEx].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 +} + +var vtprotoPool_APMBatch = sync.Pool{ + New: func() interface{} { + return &APMBatch{} + }, +} + +func (m *APMBatch) ResetVT() { + if m != nil { + for _, mm := range m.Events { + mm.ResetVT() + } + f0 := m.Events[:0] + m.Reset() + m.Events = f0 + } +} +func (m *APMBatch) ReturnToVTPool() { + if m != nil { + m.ResetVT() + vtprotoPool_APMBatch.Put(m) + } +} +func APMBatchFromVTPool() *APMBatch { + return vtprotoPool_APMBatch.Get().(*APMBatch) +} +func (m *APMBatch) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Events) > 0 { + for _, e := range m.Events { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *APMBatch) 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: APMBatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: APMBatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Events", 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 len(m.Events) == cap(m.Events) { + m.Events = append(m.Events, &APMEvent{}) + } else { + m.Events = m.Events[:len(m.Events)+1] + if m.Events[len(m.Events)-1] == nil { + m.Events[len(m.Events)-1] = &APMEvent{} + } + } + if err := m.Events[len(m.Events)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 +} diff --git a/model/proto/batch.proto b/model/proto/batch.proto new file mode 100644 index 00000000..b8915990 --- /dev/null +++ b/model/proto/batch.proto @@ -0,0 +1,29 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +syntax = "proto3"; + +package elastic.apm.v1; + +import "apmevent.proto"; + +option go_package = "github.com/elastic/apm-data/model/modelpb"; + +message APMBatch { + repeated APMEvent events = 1; +} +