From 8495728f83de615c2af219eeae0a4b1b62ce2761 Mon Sep 17 00:00:00 2001 From: Tigran Najaryan Date: Mon, 8 Jun 2020 17:23:36 -0400 Subject: [PATCH] Add support for arrays and maps for attribute values ## Summary This adds support for arrays and maps to attribute values, including support for nested values. This is a breaking protocol change. Resolves: https://github.com/open-telemetry/opentelemetry-specification/issues/376 ## Motivation There are several reasons for this change: - The API defines that attributes values [may contain arrays of values](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#set-attributes). However the protocol has no way of representing array values. - We intend to support Log data type in the protocol, which also requires array values (it is a Log Data Model requirement). In addition, Log data type requires support of key-value lists (maps) as attribute values, including nested values. - There are long-standing requests to support nested values, arrays and maps for attributes: https://github.com/open-telemetry/opentelemetry-specification/issues/376 https://github.com/open-telemetry/opentelemetry-specification/pull/596 This change introduces AnyValue. AnyValue can represent arbitrary numeric, boolean, string, arrays or maps of values and allows for nesting. AnyValue can represent any data that can be represented in JSON. AttributeKeyValue now uses AnyValue to store the "value" part. Note: below "Current" refers to the state of the "master" branch before this PR/commit is merged. "Proposed" refers to the schema suggested in this PR/commit. ## Performance This change has a negative impact on the performance (compared to current OTLP state): ``` BenchmarkEncode/Current/Trace/Attribs-8 813 1479588 ns/op BenchmarkEncode/Proposed/Trace/Attribs-8 417 2873476 ns/op BenchmarkEncode/OpenCensus/Trace/Attribs-8 162 7354799 ns/op BenchmarkDecode/Current/Trace/Attribs-8 460 2646059 ns/op 1867627 B/op 36201 allocs/op BenchmarkDecode/Proposed/Trace/Attribs-8 246 4827671 ns/op 2171734 B/op 56209 allocs/op BenchmarkDecode/OpenCensus/Trace/Attribs-8 154 7560952 ns/op 2775949 B/op 76166 allocs/op ``` However, I do not think this is important for most applications. Serialization CPU and Memory usage is going to be a tiny portion of consumed resources for most applications, except certain specialized ones. For the perspective I am also showing OpenCensus in the benchmark to make it clear that we are still significantly faster than it despite becoming slower compared to current state. More importantly, performance critical applications can use Gogo ProtoBuf generator (Collector does use it), which _gains_ performance due to this change: ``` BenchmarkEncode/Current(Gogo)/Trace/Attribs-8 1645 705385 ns/op BenchmarkEncode/Proposed(Gogo)/Trace/Attribs-8 1555 698771 ns/op BenchmarkDecode/Current(Gogo)/Trace/Attribs-8 537 2241570 ns/op 2139634 B/op 36201 allocs/op BenchmarkDecode/Proposed(Gogo)/Trace/Attribs-8 600 2053120 ns/op 1323287 B/op 46205 allocs/op ``` With Gogoproto proposed approach uses 40% less memory than the current schema. After considering all tradeoffs and alternates (see below) I believe this proposal is the best overall approach for OTLP. It is idiomatic ProtoBuf, easy to read and understand, is futureproof to adding new attribute types, has enough flexibility to represent simple and complex attribute values for all telemetry types and can be made fast by custom code generation for applications where it matters. Note: all performance measurements are done for Go implementation only (although it is expected that other languages should exhibit somewhat similar behavior). ## Alternates Considered I also designed and benchmarked several alternate schemas, see below. ### Adding array value to AttributeKeyValue This is the simples approach. It doubles down on the current OTLP protocol approach and simply adds "array_values" field to AttributeKeyValue, e.g.: ```proto message AttributeKeyValue { // all existing fields here. // A list of values. "key" field of each element in the list is ignored. repeated AttributeKeyValue array_values = 7; } ``` This eliminates the need to have a separate AnyValue message and has lower CPU usage because it requires less indirections and less memory allocations per value. However, this is semantically incorrect since the elements of the array must actually be values not key-value pairs, which this schema violates. It also uses more memory than the proposed approach: ```proto BenchmarkEncode/Proposed/Trace/Attribs-8 400 2869055 ns/op BenchmarkEncode/MoreFieldsinAKV/Trace/Attribs-8 754 1540978 ns/op BenchmarkDecode/Proposed/Trace/Attribs-8 250 4790010 ns/op 2171741 B/op 56209 allocs/op BenchmarkDecode/MoreFieldsinAKV/Trace/Attribs-8 420 2806918 ns/op 2347827 B/op 36201 allocs/op ``` It will become even worse if in the future we need to add more data types to attributes. This approach is not scalable for future needs and is semantically wrong. ### Fat AnyValue instead of oneof. In this approach AnyValue contains all possible field types (similarly to how AttributeKeyValue is currently): ```proto message AnyValue { ValueType type = 1; bool bool_value = 2; string string_value = 3; int64 int_value = 4; double double_value = 5; repeated AnyValue list_values = 6; repeated AttributeKeyValue kvlist_values = 7; } message AttributeKeyValue { string key = 1; AnyValue value = 2; } ``` This simplifies the schema however it results in significantly bigger AnyValue in-memory. In vast majority of cases attribute values are strings. Integer and boolean values are also used (although significantly less frequently than strings). Floating point number, arrays and maps are likely going to be diminishingly rare in the attributes. If we kept all these value types in AnyValue we would pay the cost for all these fields although almost always only string value would be present. Here are benchmarks comparing proposed schema and schema with fat AnyValue and using string and integer attributes in spans: ``` BenchmarkEncode/Proposed/Trace/Attribs-8 415 2894513 ns/op 456866 B/op 10005 allocs/op BenchmarkEncode/FatAnyValue/Trace/Attribs-8 646 1885003 ns/op 385024 B/op 1 allocs/op BenchmarkDecode/Proposed/Trace/Attribs-8 247 4872270 ns/op 2171746 B/op 56209 allocs/op BenchmarkDecode/FatAnyValue/Trace/Attribs-8 343 3423494 ns/op 2988081 B/op 46205 allocs/op ``` Memory usage with this approach is much higher and it also is not futureproof and will become worse as we add more types. ### AnyValue plus ExoticValue This is based on fat AnyValue approach but rarely used value types are moved to separate ExoticValue message that may be referenced from AnyValue if needed: ```proto message AnyValue { ValueType type = 1; bool bool_value = 2; string string_value = 3; int64 int_value = 4; ExoticValue exotic_value = 5; } message ExoticValue { double double_value = 1; repeated AnyValue array_values = 2; repeated AttributeKeyValue kvlist_values = 3; } message AttributeKeyValue { string key = 1; AnyValue value = 2; } ``` While this improves the performance (particularly lowers memory usage for most frequently used types of attributes) it is awkward and sacrifices too much readability and usability for small performance gains. Also for the rare cases it is slow and uses even more memory so its edge case behavior is not desirable. ### Using different schema for log data type I also considered using a different message definition for LogRecord attributes. This would allow to eliminate some of the requirements that we do not yet formally have for Span attributes (particularly the need to have maps of nested values). However, this does not help much in terms of performance, makes Span and LogRecord attributes non-interchangeable and significantly increases the bloat of code in applications that need to work with both Spans and Log records. --- encodings/encoding_test.go | 49 ++- encodings/experimental2/common.pb.go | 201 +++++------ encodings/experimental2/common.proto | 81 +---- encodings/experimental2/generator.go | 1 + encodings/otlp_gogo3/common/v1/common.pb.go | 312 ++++++++---------- .../proto/common/v1/common.proto | 80 +---- 6 files changed, 251 insertions(+), 473 deletions(-) diff --git a/encodings/encoding_test.go b/encodings/encoding_test.go index 013e19a..e57c853 100644 --- a/encodings/encoding_test.go +++ b/encodings/encoding_test.go @@ -13,12 +13,9 @@ import ( "github.com/golang/protobuf/proto" "github.com/tigrannajaryan/exp-otelproto/core" + "github.com/tigrannajaryan/exp-otelproto/encodings/baseline" "github.com/tigrannajaryan/exp-otelproto/encodings/experimental" "github.com/tigrannajaryan/exp-otelproto/encodings/experimental2" - "github.com/tigrannajaryan/exp-otelproto/encodings/octraceprotobuf" - "github.com/tigrannajaryan/exp-otelproto/encodings/otlp" - "github.com/tigrannajaryan/exp-otelproto/encodings/otlp_gogo" - "github.com/tigrannajaryan/exp-otelproto/encodings/otlp_gogo3" ) const spansPerBatch = 1000 @@ -33,31 +30,27 @@ var tests = []struct { name string gen func() core.Generator }{ - { - name: "OpenCensus", - gen: func() core.Generator { return octraceprotobuf.NewGenerator() }, - }, - //{ - // name: "SeparateAnyValue", - // gen: func() core.Generator { return baseline.NewGenerator() }, - //}, //{ // name: "SepAnyExtValue", // gen: func() core.Generator { return baseline2.NewGenerator() }, //}, //{ - // name: "MoreFieldsinAKV", - // gen: func() core.Generator { return experimental.NewGenerator() }, + // name: "Current", + // gen: func() core.Generator { return otlp.NewGenerator() }, //}, { name: "Proposed", gen: func() core.Generator { return experimental2.NewGenerator() }, }, { - name: "OTLP(Current)", - gen: func() core.Generator { return otlp.NewGenerator() }, + name: "FatAnyValue", + gen: func() core.Generator { return baseline.NewGenerator() }, }, //{ + // name: "MoreFieldsinAKV", + // gen: func() core.Generator { return experimental.NewGenerator() }, + //}, + //{ // name: "Proposed", // gen: func() core.Generator { return baseline.NewGenerator() }, //}, @@ -65,18 +58,22 @@ var tests = []struct { // name: "Alternate", // gen: func() core.Generator { return experimental.NewGenerator() }, //}, - { - name: "OTLP(Gogo)", - gen: func() core.Generator { return otlp_gogo.NewGenerator() }, - }, + //{ + // name: "Current(Gogo)", + // gen: func() core.Generator { return otlp_gogo.NewGenerator() }, + //}, //{ // name: "gogoCustom", // gen: func() core.Generator { return otlp_gogo2.NewGenerator() }, //}, - { - name: "Proposed(Gogo)", - gen: func() core.Generator { return otlp_gogo3.NewGenerator() }, - }, + //{ + // name: "Proposed(Gogo)", + // gen: func() core.Generator { return otlp_gogo3.NewGenerator() }, + //}, + //{ + // name: "OpenCensus", + // gen: func() core.Generator { return octraceprotobuf.NewGenerator() }, + //}, //// These are historical experiments. Uncomment if interested to see results. //{ // name: "OC+AttrAsMap", @@ -92,9 +89,9 @@ var batchTypes = []struct { name string batchGen func(gen core.Generator) []core.ExportRequest }{ - {name: "Logs", batchGen: generateLogBatches}, + //{name: "Logs", batchGen: generateLogBatches}, {name: "Trace/Attribs", batchGen: generateAttrBatches}, - {name: "Trace/Events", batchGen: generateTimedEventBatches}, + //{name: "Trace/Events", batchGen: generateTimedEventBatches}, //{name: "Metric/Int64", batchGen: generateMetricInt64Batches}, //{name: "Metric/Summary", batchGen: generateMetricSummaryBatches}, //{name: "Metric/Histogram", batchGen: generateMetricHistogramBatches}, diff --git a/encodings/experimental2/common.pb.go b/encodings/experimental2/common.pb.go index 23609bf..18e8171 100644 --- a/encodings/experimental2/common.pb.go +++ b/encodings/experimental2/common.pb.go @@ -20,57 +20,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// ValueType is the enumeration of possible types that a value can have. -type ValueType int32 - -const ( - // String is in `AnyValue.string_value`. Strings are the most common value types and - // we using 0 value for enum results in omission of the type from the wire (and hence - // more compact representation). - ValueType_STRING ValueType = 0 - // 64-bit int is in `AnyValue.int_value`. - ValueType_INT ValueType = 1 - // Boolean field is in `AnyValue.bool_value`. - ValueType_BOOL ValueType = 2 - // 64-bit float. - ValueType_DOUBLE ValueType = 3 - // Array of values is in `ExoticValue.array_values` field. - ValueType_ARRAY ValueType = 4 - // Key-value list is in `ExoticValue.kvlist_values` field. - ValueType_KVLIST ValueType = 5 - // Spec requires that "null values within arrays MUST be preserved as-is". Use this - // type to represent null values. All other fields in AnyValue are not set. - ValueType_NULL ValueType = 6 -) - -var ValueType_name = map[int32]string{ - 0: "STRING", - 1: "INT", - 2: "BOOL", - 3: "DOUBLE", - 4: "ARRAY", - 5: "KVLIST", - 6: "NULL", -} - -var ValueType_value = map[string]int32{ - "STRING": 0, - "INT": 1, - "BOOL": 2, - "DOUBLE": 3, - "ARRAY": 4, - "KVLIST": 5, - "NULL": 6, -} - -func (x ValueType) String() string { - return proto.EnumName(ValueType_name, int32(x)) -} - -func (ValueType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_555bd8c177793206, []int{0} -} - // Resource information. type Resource struct { // Set of labels that describe the resource. @@ -124,12 +73,15 @@ func (m *Resource) GetDroppedAttributesCount() uint32 { // AnyValue is used to represent any type of attribute value. AnyValue may contain a // primitive value such as a string or integer or it may contain an arbitrary nested -// object containing arrays, key-value lists and and primitives. AnyValue can represent +// object containing arrays, key-value lists and primitives. AnyValue can represent // any data that JSON can represent. type AnyValue struct { + // The value is one of the listed fields. It is valid for all values to be unspecified + // in which case this AnyValue is considered to be "null". + // // Types that are valid to be assigned to Value: - // *AnyValue_BoolValue // *AnyValue_StringValue + // *AnyValue_BoolValue // *AnyValue_IntValue // *AnyValue_DoubleValue // *AnyValue_ArrayValues @@ -169,34 +121,34 @@ type isAnyValue_Value interface { isAnyValue_Value() } -type AnyValue_BoolValue struct { - BoolValue bool `protobuf:"varint,2,opt,name=bool_value,json=boolValue,proto3,oneof"` +type AnyValue_StringValue struct { + StringValue string `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3,oneof"` } -type AnyValue_StringValue struct { - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` +type AnyValue_BoolValue struct { + BoolValue bool `protobuf:"varint,2,opt,name=bool_value,json=boolValue,proto3,oneof"` } type AnyValue_IntValue struct { - IntValue int64 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3,oneof"` + IntValue int64 `protobuf:"varint,3,opt,name=int_value,json=intValue,proto3,oneof"` } type AnyValue_DoubleValue struct { - DoubleValue float64 `protobuf:"fixed64,5,opt,name=double_value,json=doubleValue,proto3,oneof"` + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3,oneof"` } type AnyValue_ArrayValues struct { - ArrayValues *ArrayValue `protobuf:"bytes,6,opt,name=array_values,json=arrayValues,proto3,oneof"` + ArrayValues *ArrayValue `protobuf:"bytes,5,opt,name=array_values,json=arrayValues,proto3,oneof"` } type AnyValue_KvlistValues struct { - KvlistValues *KVList `protobuf:"bytes,7,opt,name=kvlist_values,json=kvlistValues,proto3,oneof"` + KvlistValues *AttributeKeyValueList `protobuf:"bytes,6,opt,name=kvlist_values,json=kvlistValues,proto3,oneof"` } -func (*AnyValue_BoolValue) isAnyValue_Value() {} - func (*AnyValue_StringValue) isAnyValue_Value() {} +func (*AnyValue_BoolValue) isAnyValue_Value() {} + func (*AnyValue_IntValue) isAnyValue_Value() {} func (*AnyValue_DoubleValue) isAnyValue_Value() {} @@ -212,13 +164,6 @@ func (m *AnyValue) GetValue() isAnyValue_Value { return nil } -func (m *AnyValue) GetBoolValue() bool { - if x, ok := m.GetValue().(*AnyValue_BoolValue); ok { - return x.BoolValue - } - return false -} - func (m *AnyValue) GetStringValue() string { if x, ok := m.GetValue().(*AnyValue_StringValue); ok { return x.StringValue @@ -226,6 +171,13 @@ func (m *AnyValue) GetStringValue() string { return "" } +func (m *AnyValue) GetBoolValue() bool { + if x, ok := m.GetValue().(*AnyValue_BoolValue); ok { + return x.BoolValue + } + return false +} + func (m *AnyValue) GetIntValue() int64 { if x, ok := m.GetValue().(*AnyValue_IntValue); ok { return x.IntValue @@ -247,7 +199,7 @@ func (m *AnyValue) GetArrayValues() *ArrayValue { return nil } -func (m *AnyValue) GetKvlistValues() *KVList { +func (m *AnyValue) GetKvlistValues() *AttributeKeyValueList { if x, ok := m.GetValue().(*AnyValue_KvlistValues); ok { return x.KvlistValues } @@ -257,8 +209,8 @@ func (m *AnyValue) GetKvlistValues() *KVList { // XXX_OneofWrappers is for the internal use of the proto package. func (*AnyValue) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*AnyValue_BoolValue)(nil), (*AnyValue_StringValue)(nil), + (*AnyValue_BoolValue)(nil), (*AnyValue_IntValue)(nil), (*AnyValue_DoubleValue)(nil), (*AnyValue_ArrayValues)(nil), @@ -267,6 +219,7 @@ func (*AnyValue) XXX_OneofWrappers() []interface{} { } type ArrayValue struct { + // Array of values. The array may be empty (contain 0 elements). ArrayValues []*AnyValue `protobuf:"bytes,1,rep,name=array_values,json=arrayValues,proto3" json:"array_values,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -305,39 +258,40 @@ func (m *ArrayValue) GetArrayValues() []*AnyValue { return nil } -type KVList struct { +type AttributeKeyValueList struct { + // List of key-value pairs. The list may be empty (contain 0 elements). KvlistValues []*AttributeKeyValue `protobuf:"bytes,1,rep,name=kvlist_values,json=kvlistValues,proto3" json:"kvlist_values,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *KVList) Reset() { *m = KVList{} } -func (m *KVList) String() string { return proto.CompactTextString(m) } -func (*KVList) ProtoMessage() {} -func (*KVList) Descriptor() ([]byte, []int) { +func (m *AttributeKeyValueList) Reset() { *m = AttributeKeyValueList{} } +func (m *AttributeKeyValueList) String() string { return proto.CompactTextString(m) } +func (*AttributeKeyValueList) ProtoMessage() {} +func (*AttributeKeyValueList) Descriptor() ([]byte, []int) { return fileDescriptor_555bd8c177793206, []int{3} } -func (m *KVList) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KVList.Unmarshal(m, b) +func (m *AttributeKeyValueList) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AttributeKeyValueList.Unmarshal(m, b) } -func (m *KVList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KVList.Marshal(b, m, deterministic) +func (m *AttributeKeyValueList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AttributeKeyValueList.Marshal(b, m, deterministic) } -func (m *KVList) XXX_Merge(src proto.Message) { - xxx_messageInfo_KVList.Merge(m, src) +func (m *AttributeKeyValueList) XXX_Merge(src proto.Message) { + xxx_messageInfo_AttributeKeyValueList.Merge(m, src) } -func (m *KVList) XXX_Size() int { - return xxx_messageInfo_KVList.Size(m) +func (m *AttributeKeyValueList) XXX_Size() int { + return xxx_messageInfo_AttributeKeyValueList.Size(m) } -func (m *KVList) XXX_DiscardUnknown() { - xxx_messageInfo_KVList.DiscardUnknown(m) +func (m *AttributeKeyValueList) XXX_DiscardUnknown() { + xxx_messageInfo_AttributeKeyValueList.DiscardUnknown(m) } -var xxx_messageInfo_KVList proto.InternalMessageInfo +var xxx_messageInfo_AttributeKeyValueList proto.InternalMessageInfo -func (m *KVList) GetKvlistValues() []*AttributeKeyValue { +func (m *AttributeKeyValueList) GetKvlistValues() []*AttributeKeyValue { if m != nil { return m.KvlistValues } @@ -492,11 +446,10 @@ func (m *InstrumentationLibrary) GetVersion() string { } func init() { - proto.RegisterEnum("experimental2.ValueType", ValueType_name, ValueType_value) proto.RegisterType((*Resource)(nil), "experimental2.Resource") proto.RegisterType((*AnyValue)(nil), "experimental2.AnyValue") proto.RegisterType((*ArrayValue)(nil), "experimental2.ArrayValue") - proto.RegisterType((*KVList)(nil), "experimental2.KVList") + proto.RegisterType((*AttributeKeyValueList)(nil), "experimental2.AttributeKeyValueList") proto.RegisterType((*AttributeKeyValue)(nil), "experimental2.AttributeKeyValue") proto.RegisterType((*StringKeyValue)(nil), "experimental2.StringKeyValue") proto.RegisterType((*InstrumentationLibrary)(nil), "experimental2.InstrumentationLibrary") @@ -505,39 +458,35 @@ func init() { func init() { proto.RegisterFile("common.proto", fileDescriptor_555bd8c177793206) } var fileDescriptor_555bd8c177793206 = []byte{ - // 536 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xef, 0x6a, 0xdb, 0x3c, - 0x14, 0xc6, 0xe3, 0x38, 0xff, 0x7c, 0x9a, 0xbe, 0xf8, 0x15, 0x5b, 0xe7, 0xc2, 0xc6, 0x4c, 0xf6, - 0xc5, 0x0c, 0x66, 0x68, 0xf6, 0xa5, 0x8c, 0x31, 0x96, 0x74, 0xdd, 0x1c, 0x62, 0x92, 0xe2, 0xb8, - 0x19, 0xfb, 0x14, 0x9c, 0x44, 0x0c, 0xd1, 0x44, 0x32, 0x92, 0x1c, 0x96, 0x1b, 0xd8, 0x4d, 0xec, - 0x0e, 0x77, 0x15, 0x43, 0x92, 0x93, 0x36, 0x19, 0x94, 0x7d, 0x93, 0x9e, 0xf3, 0x7b, 0x9e, 0x73, - 0xac, 0x83, 0xa1, 0xbd, 0x60, 0xeb, 0x35, 0xa3, 0x61, 0xce, 0x99, 0x64, 0xe8, 0x14, 0xff, 0xc8, - 0x31, 0x27, 0x6b, 0x4c, 0x65, 0xb6, 0xea, 0x76, 0x7e, 0x5a, 0xd0, 0x4a, 0xb0, 0x60, 0x05, 0x5f, - 0x60, 0xf4, 0x11, 0x20, 0x93, 0x92, 0x93, 0x79, 0x21, 0xb1, 0xf0, 0x2c, 0xdf, 0x0e, 0x4e, 0xba, - 0x7e, 0x78, 0x60, 0x08, 0x7b, 0x3b, 0x60, 0x88, 0xb7, 0xd3, 0x6c, 0x55, 0xe0, 0xe4, 0x81, 0x07, - 0x5d, 0x82, 0xb7, 0xe4, 0x2c, 0xcf, 0xf1, 0x72, 0x76, 0xaf, 0xce, 0x16, 0xac, 0xa0, 0xd2, 0xab, - 0xfa, 0x56, 0x70, 0x9a, 0x9c, 0x95, 0xf5, 0x7d, 0x8e, 0xb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, 0x00, + // 466 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xce, 0x26, 0xfd, 0x49, 0x26, 0x09, 0x82, 0x15, 0x14, 0x57, 0x02, 0x61, 0x19, 0x0e, 0xbe, + 0x60, 0xa9, 0xe1, 0x52, 0x71, 0x40, 0x34, 0x15, 0xc8, 0xa8, 0x95, 0xa8, 0x96, 0xaa, 0x47, 0xa2, + 0xb5, 0xb3, 0x42, 0xab, 0x3a, 0xbb, 0xd6, 0xee, 0x3a, 0x22, 0x2f, 0xc0, 0xc3, 0xf0, 0x68, 0x3c, + 0x05, 0xda, 0x9f, 0xa4, 0x8d, 0x41, 0x81, 0xdb, 0xce, 0x37, 0xdf, 0xf7, 0xcd, 0x78, 0x66, 0x0c, + 0xa3, 0x52, 0x2e, 0x16, 0x52, 0x64, 0xb5, 0x92, 0x46, 0xe2, 0x31, 0xfb, 0x5e, 0x33, 0xc5, 0x17, + 0x4c, 0x18, 0x5a, 0x4d, 0x92, 0x1f, 0x08, 0xfa, 0x84, 0x69, 0xd9, 0xa8, 0x92, 0xe1, 0xf7, 0x00, + 0xd4, 0x18, 0xc5, 0x8b, 0xc6, 0x30, 0x1d, 0xa1, 0xb8, 0x97, 0x0e, 0x27, 0x71, 0xb6, 0x25, 0xc8, + 0xce, 0xd6, 0x84, 0x0b, 0xb6, 0xba, 0xa1, 0x55, 0xc3, 0xc8, 0x3d, 0x0d, 0x3e, 0x85, 0x68, 0xae, + 0x64, 0x5d, 0xb3, 0xf9, 0xec, 0x0e, 0x9d, 0x95, 0xb2, 0x11, 0x26, 0xea, 0xc6, 0x28, 0x1d, 0x93, + 0xa3, 0x90, 0xdf, 0xf8, 0xe8, 0x73, 0x9b, 0x4d, 0x7e, 0x76, 0xa1, 0x7f, 0x26, 0xbc, 0x25, 0x7e, + 0x09, 0x23, 0x6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25, 0xec, 0xb0, 0x7c, 0x7c, 0xdf, 0x72, 0xb0, 0x56, + 0x7e, 0x84, 0xa3, 0x4f, 0x42, 0x1b, 0xd5, 0x38, 0x6b, 0xc3, 0xa5, 0xb8, 0xe4, 0x85, 0xa2, 0x6a, + 0x85, 0x31, 0xec, 0x09, 0xba, 0x08, 0xb7, 0x46, 0xdc, 0x1b, 0x47, 0x70, 0xb8, 0x64, 0x4a, 0x73, + 0x29, 0x82, 0xcb, 0x3a, 0x9c, 0xe6, 0xf0, 0x8c, 0xcb, 0x4c, 0xd6, 0x4c, 0x94, 0x4c, 0xe8, 0x46, + 0xfb, 0xbf, 0x2b, 0x33, 0x8a, 0x96, 0x2c, 0x5b, 0x9e, 0x4c, 0xe1, 0xda, 0xbe, 0xae, 0x2c, 0x78, + 0x85, 0x7e, 0x75, 0x8f, 0x3f, 0xd7, 0x4c, 0x9c, 0x7b, 0xa6, 0x03, 0x33, 0x97, 0xcf, 0x6e, 0x4e, + 0x8a, 0x03, 0xa7, 0x7c, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x28, 0x49, 0x17, 0xa7, 0x03, + 0x00, 0x00, } diff --git a/encodings/experimental2/common.proto b/encodings/experimental2/common.proto index 4f362be..a9c05e4 100644 --- a/encodings/experimental2/common.proto +++ b/encodings/experimental2/common.proto @@ -18,89 +18,30 @@ message Resource { uint32 dropped_attributes_count = 2; } - -// ValueType is the enumeration of possible types that a value can have. -enum ValueType { - // String is in `AnyValue.string_value`. Strings are the most common value types and - // we using 0 value for enum results in omission of the type from the wire (and hence - // more compact representation). - STRING = 0; - - // 64-bit int is in `AnyValue.int_value`. - INT = 1; - - // Boolean field is in `AnyValue.bool_value`. - BOOL = 2; - - // 64-bit float. - DOUBLE = 3; - - // Array of values is in `ExoticValue.array_values` field. - ARRAY = 4; - - // Key-value list is in `ExoticValue.kvlist_values` field. - KVLIST = 5; - - // Spec requires that "null values within arrays MUST be preserved as-is". Use this - // type to represent null values. All other fields in AnyValue are not set. - NULL = 6; -}; - // AnyValue is used to represent any type of attribute value. AnyValue may contain a // primitive value such as a string or integer or it may contain an arbitrary nested -// object containing arrays, key-value lists and and primitives. AnyValue can represent +// object containing arrays, key-value lists and primitives. AnyValue can represent // any data that JSON can represent. message AnyValue { - // type of the value. - // ValueType type = 1; - - // Only one of the following fields or one of fields in the ExoticValue message is - // supposed to contain data (determined by `type` field). - // We are deliberately not using Protobuf `oneof` for performance reasons (verified - // by benchmarks). - + // The value is one of the listed fields. It is valid for all values to be unspecified + // in which case this AnyValue is considered to be "null". oneof value { - // This is used when type=BOOL. - // (Performance note: keep `bool_value` immediately after `type` for more compact - // representation due to struct field alignment rules in Go). + string string_value = 1; bool bool_value = 2; - - // This is used when type=STRING. - string string_value = 3; - - // This is used when type=INT. - int64 int_value = 4; - - // This value is set only if `type` is DOUBLE, ARRAY or KVLIST. - //ExoticValue exotic_value = 5; - // This is used when type=DOUBLE. - double double_value = 5; - - // This is used when type=ARRAY. The array may be empty (contain 0 elements). - ArrayValue array_values = 6; - - // This is used when type=KVLIST. The list may be empty (contain 0 elements). - KVList kvlist_values = 7; + int64 int_value = 3; + double double_value = 4; + ArrayValue array_values = 5; + AttributeKeyValueList kvlist_values = 6; } } -// ExoticValue is used to represent rarely used value types. -//message ExoticValue { -// // This is used when type=DOUBLE. -// double double_value = 1; -// -// // This is used when type=ARRAY. The array may be empty (contain 0 elements). -// repeated AnyValue array_values = 2 [(gogoproto.nullable) = false]; -// -// // This is used when type=KVLIST. The list may be empty (contain 0 elements). -// repeated AttributeKeyValue kvlist_values = 3 [(gogoproto.nullable) = false]; -//} - message ArrayValue { + // Array of values. The array may be empty (contain 0 elements). repeated AnyValue array_values = 1; } -message KVList { +message AttributeKeyValueList { + // List of key-value pairs. The list may be empty (contain 0 elements). repeated AttributeKeyValue kvlist_values = 1; } diff --git a/encodings/experimental2/generator.go b/encodings/experimental2/generator.go index 8b00ef3..b8a99ed 100644 --- a/encodings/experimental2/generator.go +++ b/encodings/experimental2/generator.go @@ -39,6 +39,7 @@ func GenResource() *Resource { {Key: "Pid", Value: &AnyValue{Value:&AnyValue_IntValue{IntValue: 1234}}}, {Key: "HostName", Value: &AnyValue{Value:&AnyValue_StringValue{StringValue: "fakehost"}}}, {Key: "ServiceName", Value: &AnyValue{Value:&AnyValue_StringValue{StringValue: "generator"}}}, + {Key: "NullAttr", Value: &AnyValue{}}, }, } } diff --git a/encodings/otlp_gogo3/common/v1/common.pb.go b/encodings/otlp_gogo3/common/v1/common.pb.go index dfb9521..2b49250 100644 --- a/encodings/otlp_gogo3/common/v1/common.pb.go +++ b/encodings/otlp_gogo3/common/v1/common.pb.go @@ -24,65 +24,17 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// ValueType is the enumeration of possible types that a value can have. -type ValueType int32 - -const ( - // String is in `AnyValue.string_value`. Strings are the most common value types and - // we using 0 value for enum results in omission of the type from the wire (and hence - // more compact representation). - ValueType_STRING ValueType = 0 - // 64-bit int is in `AnyValue.int_value`. - ValueType_INT ValueType = 1 - // Boolean field is in `AnyValue.bool_value`. - ValueType_BOOL ValueType = 2 - // 64-bit float. - ValueType_DOUBLE ValueType = 3 - // Array of values is in `ExoticValue.array_values` field. - ValueType_ARRAY ValueType = 4 - // Key-value list is in `ExoticValue.kvlist_values` field. - ValueType_KVLIST ValueType = 5 - // Spec requires that "null values within arrays MUST be preserved as-is". Use this - // type to represent null values. All other fields in AnyValue are not set. - ValueType_NULL ValueType = 6 -) - -var ValueType_name = map[int32]string{ - 0: "STRING", - 1: "INT", - 2: "BOOL", - 3: "DOUBLE", - 4: "ARRAY", - 5: "KVLIST", - 6: "NULL", -} - -var ValueType_value = map[string]int32{ - "STRING": 0, - "INT": 1, - "BOOL": 2, - "DOUBLE": 3, - "ARRAY": 4, - "KVLIST": 5, - "NULL": 6, -} - -func (x ValueType) String() string { - return proto.EnumName(ValueType_name, int32(x)) -} - -func (ValueType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_62ba46dcb97aa817, []int{0} -} - // AnyValue is used to represent any type of attribute value. AnyValue may contain a // primitive value such as a string or integer or it may contain an arbitrary nested -// object containing arrays, key-value lists and and primitives. AnyValue can represent +// object containing arrays, key-value lists and primitives. AnyValue can represent // any data that JSON can represent. type AnyValue struct { + // The value is one of the listed fields. It is valid for all values to be unspecified + // in which case this AnyValue is considered to be "null". + // // Types that are valid to be assigned to Value: - // *AnyValue_BoolValue // *AnyValue_StringValue + // *AnyValue_BoolValue // *AnyValue_IntValue // *AnyValue_DoubleValue // *AnyValue_ArrayValues @@ -129,27 +81,27 @@ type isAnyValue_Value interface { Size() int } +type AnyValue_StringValue struct { + StringValue string `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3,oneof" json:"string_value,omitempty"` +} type AnyValue_BoolValue struct { BoolValue bool `protobuf:"varint,2,opt,name=bool_value,json=boolValue,proto3,oneof" json:"bool_value,omitempty"` } -type AnyValue_StringValue struct { - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof" json:"string_value,omitempty"` -} type AnyValue_IntValue struct { - IntValue int64 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3,oneof" json:"int_value,omitempty"` + IntValue int64 `protobuf:"varint,3,opt,name=int_value,json=intValue,proto3,oneof" json:"int_value,omitempty"` } type AnyValue_DoubleValue struct { - DoubleValue float64 `protobuf:"fixed64,5,opt,name=double_value,json=doubleValue,proto3,oneof" json:"double_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3,oneof" json:"double_value,omitempty"` } type AnyValue_ArrayValues struct { - ArrayValues *ArrayValue `protobuf:"bytes,6,opt,name=array_values,json=arrayValues,proto3,oneof" json:"array_values,omitempty"` + ArrayValues *ArrayValue `protobuf:"bytes,5,opt,name=array_values,json=arrayValues,proto3,oneof" json:"array_values,omitempty"` } type AnyValue_KvlistValues struct { - KvlistValues *KVList `protobuf:"bytes,7,opt,name=kvlist_values,json=kvlistValues,proto3,oneof" json:"kvlist_values,omitempty"` + KvlistValues *AttributeKeyValueList `protobuf:"bytes,6,opt,name=kvlist_values,json=kvlistValues,proto3,oneof" json:"kvlist_values,omitempty"` } -func (*AnyValue_BoolValue) isAnyValue_Value() {} func (*AnyValue_StringValue) isAnyValue_Value() {} +func (*AnyValue_BoolValue) isAnyValue_Value() {} func (*AnyValue_IntValue) isAnyValue_Value() {} func (*AnyValue_DoubleValue) isAnyValue_Value() {} func (*AnyValue_ArrayValues) isAnyValue_Value() {} @@ -162,13 +114,6 @@ func (m *AnyValue) GetValue() isAnyValue_Value { return nil } -func (m *AnyValue) GetBoolValue() bool { - if x, ok := m.GetValue().(*AnyValue_BoolValue); ok { - return x.BoolValue - } - return false -} - func (m *AnyValue) GetStringValue() string { if x, ok := m.GetValue().(*AnyValue_StringValue); ok { return x.StringValue @@ -176,6 +121,13 @@ func (m *AnyValue) GetStringValue() string { return "" } +func (m *AnyValue) GetBoolValue() bool { + if x, ok := m.GetValue().(*AnyValue_BoolValue); ok { + return x.BoolValue + } + return false +} + func (m *AnyValue) GetIntValue() int64 { if x, ok := m.GetValue().(*AnyValue_IntValue); ok { return x.IntValue @@ -197,7 +149,7 @@ func (m *AnyValue) GetArrayValues() *ArrayValue { return nil } -func (m *AnyValue) GetKvlistValues() *KVList { +func (m *AnyValue) GetKvlistValues() *AttributeKeyValueList { if x, ok := m.GetValue().(*AnyValue_KvlistValues); ok { return x.KvlistValues } @@ -207,8 +159,8 @@ func (m *AnyValue) GetKvlistValues() *KVList { // XXX_OneofWrappers is for the internal use of the proto package. func (*AnyValue) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*AnyValue_BoolValue)(nil), (*AnyValue_StringValue)(nil), + (*AnyValue_BoolValue)(nil), (*AnyValue_IntValue)(nil), (*AnyValue_DoubleValue)(nil), (*AnyValue_ArrayValues)(nil), @@ -217,6 +169,7 @@ func (*AnyValue) XXX_OneofWrappers() []interface{} { } type ArrayValue struct { + // Array of values. The array may be empty (contain 0 elements). ArrayValues []AnyValue `protobuf:"bytes,1,rep,name=array_values,json=arrayValues,proto3" json:"array_values"` } @@ -260,22 +213,23 @@ func (m *ArrayValue) GetArrayValues() []AnyValue { return nil } -type KVList struct { +type AttributeKeyValueList struct { + // List of key-value pairs. The list may be empty (contain 0 elements). KvlistValues []AttributeKeyValue `protobuf:"bytes,1,rep,name=kvlist_values,json=kvlistValues,proto3" json:"kvlist_values"` } -func (m *KVList) Reset() { *m = KVList{} } -func (m *KVList) String() string { return proto.CompactTextString(m) } -func (*KVList) ProtoMessage() {} -func (*KVList) Descriptor() ([]byte, []int) { +func (m *AttributeKeyValueList) Reset() { *m = AttributeKeyValueList{} } +func (m *AttributeKeyValueList) String() string { return proto.CompactTextString(m) } +func (*AttributeKeyValueList) ProtoMessage() {} +func (*AttributeKeyValueList) Descriptor() ([]byte, []int) { return fileDescriptor_62ba46dcb97aa817, []int{2} } -func (m *KVList) XXX_Unmarshal(b []byte) error { +func (m *AttributeKeyValueList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *KVList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *AttributeKeyValueList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_KVList.Marshal(b, m, deterministic) + return xxx_messageInfo_AttributeKeyValueList.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -285,19 +239,19 @@ func (m *KVList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *KVList) XXX_Merge(src proto.Message) { - xxx_messageInfo_KVList.Merge(m, src) +func (m *AttributeKeyValueList) XXX_Merge(src proto.Message) { + xxx_messageInfo_AttributeKeyValueList.Merge(m, src) } -func (m *KVList) XXX_Size() int { +func (m *AttributeKeyValueList) XXX_Size() int { return m.Size() } -func (m *KVList) XXX_DiscardUnknown() { - xxx_messageInfo_KVList.DiscardUnknown(m) +func (m *AttributeKeyValueList) XXX_DiscardUnknown() { + xxx_messageInfo_AttributeKeyValueList.DiscardUnknown(m) } -var xxx_messageInfo_KVList proto.InternalMessageInfo +var xxx_messageInfo_AttributeKeyValueList proto.InternalMessageInfo -func (m *KVList) GetKvlistValues() []AttributeKeyValue { +func (m *AttributeKeyValueList) GetKvlistValues() []AttributeKeyValue { if m != nil { return m.KvlistValues } @@ -467,10 +421,9 @@ func (m *InstrumentationLibrary) GetVersion() string { } func init() { - proto.RegisterEnum("opentelemetrygogo3.proto.common.v1.ValueType", ValueType_name, ValueType_value) proto.RegisterType((*AnyValue)(nil), "opentelemetrygogo3.proto.common.v1.AnyValue") proto.RegisterType((*ArrayValue)(nil), "opentelemetrygogo3.proto.common.v1.ArrayValue") - proto.RegisterType((*KVList)(nil), "opentelemetrygogo3.proto.common.v1.KVList") + proto.RegisterType((*AttributeKeyValueList)(nil), "opentelemetrygogo3.proto.common.v1.AttributeKeyValueList") proto.RegisterType((*AttributeKeyValue)(nil), "opentelemetrygogo3.proto.common.v1.AttributeKeyValue") proto.RegisterType((*StringKeyValue)(nil), "opentelemetrygogo3.proto.common.v1.StringKeyValue") proto.RegisterType((*InstrumentationLibrary)(nil), "opentelemetrygogo3.proto.common.v1.InstrumentationLibrary") @@ -481,44 +434,39 @@ func init() { } var fileDescriptor_62ba46dcb97aa817 = []byte{ - // 580 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xdd, 0x6e, 0xd3, 0x30, - 0x14, 0xc7, 0xe3, 0xf5, 0xfb, 0x74, 0xa0, 0x60, 0x21, 0x54, 0x21, 0xd1, 0x45, 0xe5, 0xa6, 0x9a, - 0x58, 0xa3, 0x6d, 0x42, 0xe2, 0xb6, 0x01, 0x46, 0xab, 0x45, 0xdb, 0x48, 0xbb, 0x21, 0xb8, 0x19, - 0xc9, 0x66, 0x82, 0xb7, 0xd4,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 0x8d, 0xc7, 0xf9, 0x94, 0x60, 0x80, 0xea, 0x68, 0x1c, 0x0c, 0x77, 0xde, - 0xd8, 0x16, 0xae, 0x41, 0x69, 0xb8, 0x33, 0xb6, 0x11, 0xae, 0x43, 0xd9, 0xdb, 0xdd, 0xf5, 0xed, - 0x25, 0xf5, 0xf9, 0xd5, 0xee, 0xbe, 0xe7, 0xbf, 0xb6, 0x4b, 0xb8, 0x01, 0x95, 0x7e, 0x10, 0xf4, - 0xdf, 0xdb, 0x65, 0x55, 0xde, 0x3e, 0xf0, 0x87, 0xa3, 0xb1, 0x5d, 0x51, 0xe2, 0x9d, 0x7d, 0xdf, - 0xb7, 0xab, 0xde, 0x37, 0x74, 0x76, 0xd1, 0x46, 0xe7, 0x17, 0x6d, 0xf4, 0xeb, 0xa2, 0x8d, 0xbe, - 0x5e, 0xb6, 0xad, 0xf3, 0xcb, 0xb6, 0xf5, 0xe3, 0xb2, 0x6d, 0x81, 0x43, 0xf9, 0xfc, 0xc8, 0xee, - 0x4e, 0xcb, 0x6b, 0xbe, 0xd4, 0xe1, 0x9e, 0x2a, 0xef, 0xa1, 0x0f, 0x5b, 0xb7, 0xde, 0xb7, 0xa4, - 0xb1, 0x08, 0x19, 0x0b, 0x4f, 0x42, 0x91, 0x87, 0xcc, 0x25, 0x5f, 0xa6, 0x6b, 0x5c, 0x92, 0xc4, - 0x3c, 0x72, 0xc2, 0x8e, 0xf8, 0x31, 0x65, 0x71, 0xea, 0x72, 0x99, 0x4c, 0x0f, 0xf5, 0x51, 0xdc, - 0xfc, 0x58, 0xa2, 0xaa, 0x56, 0x6d, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x62, 0x96, 0x61, 0xeb, - 0x80, 0x04, 0x00, 0x00, + // 507 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0xf5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, + 0x52, 0xce, 0xf6, 0x69, 0x26, 0xb0, 0x68, 0x5d, 0x17, 0xba, 0x0c, 0x97, 0x76, 0xcd, 0x53, 0x1d, + 0xbb, 0x23, 0x58, 0x6f, 0x88, 0xa8, 0x28, 0x67, 0x96, 0x65, 0x91, 0x8e, 0xbf, 0xa3, 0xd3, 0x99, + 0x87, 0xce, 0x66, 0x1e, 0xfa, 0x3d, 0xf3, 0xd0, 0xb7, 0xb9, 0xe7, 0x9c, 0xcd, 0x3d, 0xe7, 0xe7, + 0xdc, 0x73, 0xc0, 0xa7, 0x7c, 0xd9, 0xd9, 0x55, 0x53, 0xe3, 0xc1, 0x6b, 0x1d, 0x1e, 0xa8, 0xf2, + 0x01, 0xfa, 0xb0, 0x77, 0xe9, 0x91, 0x4a, 0x9a, 0x0b, 0xcc, 0x18, 0xfe, 0x82, 0x45, 0x8b, 0x59, + 0x4c, 0xbe, 0x4e, 0x37, 0xb9, 0x24, 0x85, 0x79, 0xa9, 0x84, 0x4d, 0xf8, 0x31, 0x65, 0x79, 0x15, + 0x73, 0x59, 0x4c, 0x8f, 0xf4, 0xc4, 0x2e, 0xfe, 0x0e, 0xd9, 0x9a, 0x46, 0xed, 0xfc, 0x09, 0x00, + 0x00, 0xff, 0xff, 0x71, 0xa0, 0x2f, 0x62, 0x45, 0x04, 0x00, 0x00, } func (m *AnyValue) Marshal() (dAtA []byte, err error) { @@ -553,6 +501,20 @@ func (m *AnyValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AnyValue_StringValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AnyValue_StringValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.StringValue) + copy(dAtA[i:], m.StringValue) + i = encodeVarintCommon(dAtA, i, uint64(len(m.StringValue))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} func (m *AnyValue_BoolValue) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -570,20 +532,6 @@ func (m *AnyValue_BoolValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x10 return len(dAtA) - i, nil } -func (m *AnyValue_StringValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AnyValue_StringValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.StringValue) - copy(dAtA[i:], m.StringValue) - i = encodeVarintCommon(dAtA, i, uint64(len(m.StringValue))) - i-- - dAtA[i] = 0x1a - return len(dAtA) - i, nil -} func (m *AnyValue_IntValue) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -593,7 +541,7 @@ func (m *AnyValue_IntValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) i = encodeVarintCommon(dAtA, i, uint64(m.IntValue)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x18 return len(dAtA) - i, nil } func (m *AnyValue_DoubleValue) MarshalTo(dAtA []byte) (int, error) { @@ -606,7 +554,7 @@ func (m *AnyValue_DoubleValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= 8 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.DoubleValue)))) i-- - dAtA[i] = 0x29 + dAtA[i] = 0x21 return len(dAtA) - i, nil } func (m *AnyValue_ArrayValues) MarshalTo(dAtA []byte) (int, error) { @@ -626,7 +574,7 @@ func (m *AnyValue_ArrayValues) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintCommon(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } return len(dAtA) - i, nil } @@ -647,7 +595,7 @@ func (m *AnyValue_KvlistValues) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintCommon(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } return len(dAtA) - i, nil } @@ -688,7 +636,7 @@ func (m *ArrayValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *KVList) Marshal() (dAtA []byte, err error) { +func (m *AttributeKeyValueList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -698,12 +646,12 @@ func (m *KVList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *KVList) MarshalTo(dAtA []byte) (int, error) { +func (m *AttributeKeyValueList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *KVList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *AttributeKeyValueList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -862,23 +810,23 @@ func (m *AnyValue) Size() (n int) { return n } -func (m *AnyValue_BoolValue) Size() (n int) { +func (m *AnyValue_StringValue) Size() (n int) { if m == nil { return 0 } var l int _ = l - n += 2 + l = len(m.StringValue) + n += 1 + l + sovCommon(uint64(l)) return n } -func (m *AnyValue_StringValue) Size() (n int) { +func (m *AnyValue_BoolValue) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.StringValue) - n += 1 + l + sovCommon(uint64(l)) + n += 2 return n } func (m *AnyValue_IntValue) Size() (n int) { @@ -938,7 +886,7 @@ func (m *ArrayValue) Size() (n int) { return n } -func (m *KVList) Size() (n int) { +func (m *AttributeKeyValueList) Size() (n int) { if m == nil { return 0 } @@ -1037,28 +985,7 @@ func (m *AnyValue) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: AnyValue: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Value = &AnyValue_BoolValue{b} - case 3: + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) } @@ -1090,7 +1017,28 @@ func (m *AnyValue) Unmarshal(dAtA []byte) error { } m.Value = &AnyValue_StringValue{string(dAtA[iNdEx:postIndex])} iNdEx = postIndex - case 4: + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.Value = &AnyValue_BoolValue{b} + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field IntValue", wireType) } @@ -1110,7 +1058,7 @@ func (m *AnyValue) Unmarshal(dAtA []byte) error { } } m.Value = &AnyValue_IntValue{v} - case 5: + case 4: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field DoubleValue", wireType) } @@ -1121,7 +1069,7 @@ func (m *AnyValue) Unmarshal(dAtA []byte) error { v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 m.Value = &AnyValue_DoubleValue{float64(math.Float64frombits(v))} - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ArrayValues", wireType) } @@ -1156,7 +1104,7 @@ func (m *AnyValue) Unmarshal(dAtA []byte) error { } m.Value = &AnyValue_ArrayValues{v} iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field KvlistValues", wireType) } @@ -1185,7 +1133,7 @@ func (m *AnyValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &KVList{} + v := &AttributeKeyValueList{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1302,7 +1250,7 @@ func (m *ArrayValue) Unmarshal(dAtA []byte) error { } return nil } -func (m *KVList) Unmarshal(dAtA []byte) error { +func (m *AttributeKeyValueList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1325,10 +1273,10 @@ func (m *KVList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: KVList: wiretype end group for non-group") + return fmt.Errorf("proto: AttributeKeyValueList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: KVList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AttributeKeyValueList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/encodings/otlp_gogo3/opentelemetry/proto/common/v1/common.proto b/encodings/otlp_gogo3/opentelemetry/proto/common/v1/common.proto index 0b24dc9..cb5fbee 100644 --- a/encodings/otlp_gogo3/opentelemetry/proto/common/v1/common.proto +++ b/encodings/otlp_gogo3/opentelemetry/proto/common/v1/common.proto @@ -23,88 +23,30 @@ option java_package = "io.opentelemetry.proto.common.v1"; option java_outer_classname = "CommonProto"; option go_package = "github.com/tigrannajaryan/exp-otelproto/encodings/otlp_gogo3/common/v1"; -// ValueType is the enumeration of possible types that a value can have. -enum ValueType { - // String is in `AnyValue.string_value`. Strings are the most common value types and - // we using 0 value for enum results in omission of the type from the wire (and hence - // more compact representation). - STRING = 0; - - // 64-bit int is in `AnyValue.int_value`. - INT = 1; - - // Boolean field is in `AnyValue.bool_value`. - BOOL = 2; - - // 64-bit float. - DOUBLE = 3; - - // Array of values is in `ExoticValue.array_values` field. - ARRAY = 4; - - // Key-value list is in `ExoticValue.kvlist_values` field. - KVLIST = 5; - - // Spec requires that "null values within arrays MUST be preserved as-is". Use this - // type to represent null values. All other fields in AnyValue are not set. - NULL = 6; -}; - // AnyValue is used to represent any type of attribute value. AnyValue may contain a // primitive value such as a string or integer or it may contain an arbitrary nested -// object containing arrays, key-value lists and and primitives. AnyValue can represent +// object containing arrays, key-value lists and primitives. AnyValue can represent // any data that JSON can represent. message AnyValue { - // type of the value. - // ValueType type = 1; - - // Only one of the following fields or one of fields in the ExoticValue message is - // supposed to contain data (determined by `type` field). - // We are deliberately not using Protobuf `oneof` for performance reasons (verified - // by benchmarks). - + // The value is one of the listed fields. It is valid for all values to be unspecified + // in which case this AnyValue is considered to be "null". oneof value { - // This is used when type=BOOL. - // (Performance note: keep `bool_value` immediately after `type` for more compact - // representation due to struct field alignment rules in Go). + string string_value = 1; bool bool_value = 2; - - // This is used when type=STRING. - string string_value = 3; - - // This is used when type=INT. - int64 int_value = 4; - - // This value is set only if `type` is DOUBLE, ARRAY or KVLIST. - //ExoticValue exotic_value = 5; - // This is used when type=DOUBLE. - double double_value = 5; - - // This is used when type=ARRAY. The array may be empty (contain 0 elements). - ArrayValue array_values = 6; - - // This is used when type=KVLIST. The list may be empty (contain 0 elements). - KVList kvlist_values = 7; + int64 int_value = 3; + double double_value = 4; + ArrayValue array_values = 5; + AttributeKeyValueList kvlist_values = 6; } } -// ExoticValue is used to represent rarely used value types. -//message ExoticValue { -// // This is used when type=DOUBLE. -// double double_value = 1; -// -// // This is used when type=ARRAY. The array may be empty (contain 0 elements). -// repeated AnyValue array_values = 2 [(gogoproto.nullable) = false]; -// -// // This is used when type=KVLIST. The list may be empty (contain 0 elements). -// repeated AttributeKeyValue kvlist_values = 3 [(gogoproto.nullable) = false]; -//} - message ArrayValue { + // Array of values. The array may be empty (contain 0 elements). repeated AnyValue array_values = 1 [(gogoproto.nullable) = false]; } -message KVList { +message AttributeKeyValueList { + // List of key-value pairs. The list may be empty (contain 0 elements). repeated AttributeKeyValue kvlist_values = 1 [(gogoproto.nullable) = false]; }