From 4777e915f1fe645d5901cf1c0ffdeff44d98d39d Mon Sep 17 00:00:00 2001 From: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> Date: Thu, 25 Jun 2020 17:17:06 -0400 Subject: [PATCH] Update OTLP to v0.4.0 [Breaking change] (#1142) This is a breaking OTLP change. - Use AnyValue introduced in recent change to OTLP. Changes are encapsulated in AttributeValue and most of the codebase is unaffected, which proves the wrappers are very useful. - Rename AttributeKeyValue to KeyValue (the change comes from OTLP). - Use local protoc to compile ProtoBufs. Previously used znly/protoc docker image is outdated and results in incorrect code for gRPC-Gateway. TODO: - Need to add support for ARRAY value type. This is not urgent since there are no known data sources that use the ARRAY type yet. - Use Gogoproto `(gogoproto.nullable) = false` annotation for AnyValue to possibly improve performance further. --- Makefile | 4 +- cmd/pdatagen/internal/metrics_structs.go | 4 +- consumer/pdata/common.go | 363 +++- consumer/pdata/common_test.go | 377 +++- exporter/fileexporter/file_exporter_test.go | 40 +- internal/data/logsproto/logs/v1/logs.proto | 2 +- internal/data/metric_test.go | 7 +- internal/data/opentelemetry-proto | 2 +- .../metrics/v1/metrics_service.pb.go | 308 +-- .../collector/trace/v1/trace_config.pb.go | 700 ++++--- .../collector/trace/v1/trace_service.pb.go | 308 +-- .../common/v1/common.pb.go | 1505 +++++++++++--- .../logs/v1/logs.pb.go | 725 ++++--- .../metrics/v1/metrics.pb.go | 1755 ++++++++++------- .../resource/v1/resource.pb.go | 257 ++- .../trace/v1/trace.pb.go | 1174 ++++++----- internal/data/testdata/common.go | 40 +- internal/data/testdata/log.go | 24 +- internal/goldendataset/generator_commons.go | 36 +- internal/goldendataset/span_generator.go | 6 +- receiver/otlpreceiver/metrics/otlp_test.go | 6 +- receiver/otlpreceiver/otlp_test.go | 31 +- receiver/otlpreceiver/trace/otlp_test.go | 13 +- testbed/testbed/validator.go | 51 +- testbed/tests/resource_processor_test.go | 42 +- translator/internaldata/resource_to_oc.go | 36 +- .../internaldata/resource_to_oc_test.go | 16 + 27 files changed, 5086 insertions(+), 2746 deletions(-) diff --git a/Makefile b/Makefile index 3a9ff9a234c3..7292906b9b03 100644 --- a/Makefile +++ b/Makefile @@ -253,7 +253,7 @@ genproto_sub: $(foreach file,$(OPENTELEMETRY_PROTO_FILES),$(call exec-command,sed 's+github.com/open-telemetry/opentelemetry-proto/gen/go/+go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/+g' $(OPENTELEMETRY_PROTO_SRC_DIR)/$(file) > $(PROTO_INTERMEDIATE_DIR)/$(file))) @echo Generate Go code from Logs .proto files in intermediate directory. - $(foreach file,$(LOGS_PROTO_FILES),$(call exec-command,docker run --rm -v $(PWD)/$(LOGS_PROTO_SRC_DIR):$(PWD)/$(LOGS_PROTO_SRC_DIR) -v $(PWD)/$(PROTO_INTERMEDIATE_DIR):$(PWD)/$(PROTO_INTERMEDIATE_DIR) -w $(PWD)/$(LOGS_PROTO_SRC_DIR) znly/protoc --gogofaster_out=plugins=grpc:./ -I./ -I$(PWD)/$(PROTO_INTERMEDIATE_DIR) $(file))) + $(foreach file,$(LOGS_PROTO_FILES),$(call exec-command,cd $(LOGS_PROTO_SRC_DIR) && protoc --gogofaster_out=plugins=grpc:./ -I./ -I$(PWD)/$(PROTO_INTERMEDIATE_DIR) $(file))) @echo Move generated code to target directory. mkdir -p $(PROTO_TARGET_GEN_DIR) @@ -261,7 +261,7 @@ genproto_sub: rm -rf $(LOGS_PROTO_SRC_DIR)/go.opentelemetry.io @echo Generate Go code from .proto files in intermediate directory. - $(foreach file,$(OPENTELEMETRY_PROTO_FILES),$(call exec-command,docker run --rm -v $(PWD)/$(PROTO_INTERMEDIATE_DIR):$(PWD)/$(PROTO_INTERMEDIATE_DIR) -w $(PWD)/$(PROTO_INTERMEDIATE_DIR) znly/protoc --gogofaster_out=plugins=grpc:./ -I./ $(file))) + $(foreach file,$(OPENTELEMETRY_PROTO_FILES),$(call exec-command,cd $(PROTO_INTERMEDIATE_DIR) && protoc --gogofaster_out=plugins=grpc:./ -I./ $(file))) @echo Generate gRPC gateway code. cd $(PROTO_INTERMEDIATE_DIR) && protoc --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/trace/v1/trace_service_http.yaml:./ opentelemetry/proto/collector/trace/v1/trace_service.proto diff --git a/cmd/pdatagen/internal/metrics_structs.go b/cmd/pdatagen/internal/metrics_structs.go index 3ea884be303a..99a80095cba2 100644 --- a/cmd/pdatagen/internal/metrics_structs.go +++ b/cmd/pdatagen/internal/metrics_structs.go @@ -152,8 +152,8 @@ var metricDescriptor = &messageStruct{ originFieldName: "Type", returnType: "MetricType", rawType: "otlpmetrics.MetricDescriptor_Type", - defaultVal: "MetricTypeUnspecified", - testVal: "MetricTypeGaugeInt64", + defaultVal: "MetricTypeInvalid", + testVal: "MetricTypeInt64", }, }, } diff --git a/consumer/pdata/common.go b/consumer/pdata/common.go index b465404a8496..91cb0f571be0 100644 --- a/consumer/pdata/common.go +++ b/consumer/pdata/common.go @@ -32,19 +32,36 @@ func (ts TimestampUnixNano) String() string { return time.Unix(0, int64(ts)).String() } -// AttributeValueType specifies the type of value. Numerically is equal to -// otlp.AttributeKeyValue_ValueType. -type AttributeValueType otlpcommon.AttributeKeyValue_ValueType +// AttributeValueType specifies the type of AttributeValue. +type AttributeValueType int const ( - AttributeValueSTRING = AttributeValueType(otlpcommon.AttributeKeyValue_STRING) - AttributeValueINT = AttributeValueType(otlpcommon.AttributeKeyValue_INT) - AttributeValueDOUBLE = AttributeValueType(otlpcommon.AttributeKeyValue_DOUBLE) - AttributeValueBOOL = AttributeValueType(otlpcommon.AttributeKeyValue_BOOL) + AttributeValueNULL = iota + AttributeValueSTRING + AttributeValueINT + AttributeValueDOUBLE + AttributeValueBOOL + AttributeValueMAP + // TODO: add ARRAY value types. ) func (avt AttributeValueType) String() string { - return otlpcommon.AttributeKeyValue_ValueType(avt).String() + switch avt { + case AttributeValueNULL: + return "NULL" + case AttributeValueSTRING: + return "STRING" + case AttributeValueBOOL: + return "BOOL" + case AttributeValueINT: + return "INT" + case AttributeValueDOUBLE: + return "DOUBLE" + case AttributeValueMAP: + return "MAP" + } + // TODO: add cases for ARRAY value types. + return "" } // AttributeValue represents a value of an attribute. Typically used in AttributeMap. @@ -64,37 +81,62 @@ func (avt AttributeValueType) String() string { // Important: zero-initialized instance is not valid for use. All AttributeValue functions bellow must // be called only on instances that are created via NewAttributeValue+ functions. type AttributeValue struct { - orig *otlpcommon.AttributeKeyValue + // Double pointer is required so that in the Setters we can update the pointer if + // it is nil. This double pointer can be eliminated in the future if we embed AnyValue + // using Gogoproto `(gogoproto.nullable) = false` annotation. + // + // orig cannot be nil (it is an invalid instance if orig is nil). + // (*orig) may be nil. + orig **otlpcommon.AnyValue +} + +// NewAttributeValueNull creates a new AttributeValue with a null value. +func NewAttributeValueNull() AttributeValue { + orig := &otlpcommon.AnyValue{} + return AttributeValue{orig: &orig} } // NewAttributeValueString creates a new AttributeValue with the given string value. func NewAttributeValueString(v string) AttributeValue { - return AttributeValue{orig: &otlpcommon.AttributeKeyValue{Type: otlpcommon.AttributeKeyValue_STRING, StringValue: v}} + orig := &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: v}} + return AttributeValue{orig: &orig} } // NewAttributeValueInt creates a new AttributeValue with the given int64 value. func NewAttributeValueInt(v int64) AttributeValue { - return AttributeValue{orig: &otlpcommon.AttributeKeyValue{Type: otlpcommon.AttributeKeyValue_INT, IntValue: v}} + orig := &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_IntValue{IntValue: v}} + return AttributeValue{orig: &orig} } // NewAttributeValueDouble creates a new AttributeValue with the given float64 value. func NewAttributeValueDouble(v float64) AttributeValue { - return AttributeValue{orig: &otlpcommon.AttributeKeyValue{Type: otlpcommon.AttributeKeyValue_DOUBLE, DoubleValue: v}} + orig := &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_DoubleValue{DoubleValue: v}} + return AttributeValue{orig: &orig} } // NewAttributeValueBool creates a new AttributeValue with the given bool value. func NewAttributeValueBool(v bool) AttributeValue { - return AttributeValue{orig: &otlpcommon.AttributeKeyValue{Type: otlpcommon.AttributeKeyValue_BOOL, BoolValue: v}} + orig := &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_BoolValue{BoolValue: v}} + return AttributeValue{orig: &orig} +} + +// NewAttributeValueMap creates a new AttributeValue of array type. +func NewAttributeValueMap() AttributeValue { + orig := &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_KvlistValue{KvlistValue: &otlpcommon.KeyValueList{}}} + return AttributeValue{orig: &orig} } // NewAttributeValueSlice creates a slice of attributes values that are correctly initialized. func NewAttributeValueSlice(len int) []AttributeValue { - // Allocate 2 slices, one for AttributeValues, another for underlying OTLP structs. + // Allocate 3 slices, one for AttributeValues, another for underlying OTLP structs + // and another for pointers to OTLP structs. // TODO: make one allocation for both slices. - origs := make([]otlpcommon.AttributeKeyValue, len) wrappers := make([]AttributeValue, len) + origs := make([]otlpcommon.AnyValue, len) + origPtrs := make([]*otlpcommon.AnyValue, len) for i := range origs { - wrappers[i].orig = &origs[i] + origPtrs[i] = &origs[i] + wrappers[i].orig = &origPtrs[i] } return wrappers } @@ -102,138 +144,232 @@ func NewAttributeValueSlice(len int) []AttributeValue { // Type returns the type of the value for this AttributeValue. // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) Type() AttributeValueType { - return AttributeValueType(a.orig.Type) + if *a.orig == nil || (*a.orig).Value == nil { + return AttributeValueNULL + } + switch (*a.orig).Value.(type) { + case *otlpcommon.AnyValue_StringValue: + return AttributeValueSTRING + case *otlpcommon.AnyValue_BoolValue: + return AttributeValueBOOL + case *otlpcommon.AnyValue_IntValue: + return AttributeValueINT + case *otlpcommon.AnyValue_DoubleValue: + return AttributeValueDOUBLE + case *otlpcommon.AnyValue_KvlistValue: + return AttributeValueMAP + } + // TODO: add cases for ARRAY value types. + return AttributeValueNULL } // Value returns the string value associated with this AttributeValue. -// If the Type() is not AttributeValueSTRING then return empty string. +// If the Type() is not AttributeValueSTRING then returns empty string. // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) StringVal() string { - return a.orig.StringValue + return (*a.orig).GetStringValue() } // Value returns the int64 value associated with this AttributeValue. -// If the Type() is not AttributeValueINT then return int64(0). +// If the Type() is not AttributeValueINT then returns int64(0). // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) IntVal() int64 { - return a.orig.IntValue + return (*a.orig).GetIntValue() } // Value returns the float64 value associated with this AttributeValue. -// If the Type() is not AttributeValueDOUBLE then return float64(0). +// If the Type() is not AttributeValueDOUBLE then returns float64(0). // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) DoubleVal() float64 { - return a.orig.DoubleValue + return (*a.orig).GetDoubleValue() } // Value returns the bool value associated with this AttributeValue. -// If the Type() is not AttributeValueBOOL then return false. +// If the Type() is not AttributeValueBOOL then returns false. // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) BoolVal() bool { - return a.orig.BoolValue + return (*a.orig).GetBoolValue() +} + +// Value returns the map value associated with this AttributeValue. +// If the Type() is not AttributeValueMAP then returns an empty map. Note that modifying +// such empty map has no effect on this AttributeValue. +// +// Calling this function on zero-initialized AttributeValue will cause a panic. +func (a AttributeValue) MapVal() AttributeMap { + kvlist := (*a.orig).GetKvlistValue() + if kvlist == nil { + return NewAttributeMap() + } + return newAttributeMap(&kvlist.Values) } // SetStringVal replaces the string value associated with this AttributeValue, // it also changes the type to be AttributeValueSTRING. // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) SetStringVal(v string) { - a.setTypeAndClear(otlpcommon.AttributeKeyValue_STRING) - a.orig.StringValue = v + if *a.orig == nil { + // This may be nil if it was received/Unmarshaled from the wire. + *a.orig = &otlpcommon.AnyValue{} + } + (*a.orig).Value = &otlpcommon.AnyValue_StringValue{StringValue: v} } // SetIntVal replaces the int64 value associated with this AttributeValue, // it also changes the type to be AttributeValueINT. // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) SetIntVal(v int64) { - a.setTypeAndClear(otlpcommon.AttributeKeyValue_INT) - a.orig.IntValue = v + if *a.orig == nil { + *a.orig = &otlpcommon.AnyValue{} + } + (*a.orig).Value = &otlpcommon.AnyValue_IntValue{IntValue: v} } // SetDoubleVal replaces the float64 value associated with this AttributeValue, // it also changes the type to be AttributeValueDOUBLE. // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) SetDoubleVal(v float64) { - a.setTypeAndClear(otlpcommon.AttributeKeyValue_DOUBLE) - a.orig.DoubleValue = v + if *a.orig == nil { + *a.orig = &otlpcommon.AnyValue{} + } + (*a.orig).Value = &otlpcommon.AnyValue_DoubleValue{DoubleValue: v} } // SetBoolVal replaces the bool value associated with this AttributeValue, // it also changes the type to be AttributeValueBOOL. // Calling this function on zero-initialized AttributeValue will cause a panic. func (a AttributeValue) SetBoolVal(v bool) { - a.setTypeAndClear(otlpcommon.AttributeKeyValue_BOOL) - a.orig.BoolValue = v + if *a.orig == nil { + *a.orig = &otlpcommon.AnyValue{} + } + (*a.orig).Value = &otlpcommon.AnyValue_BoolValue{BoolValue: v} } -// CopyTo copies all the fields from the given AttributeValue. +// SetMapVal replaces the value associated with this AttributeValue, +// it also changes the type to be AttributeValueMAP. The `m` argument will be deep +// copied into this AttributeValue. +// // Calling this function on zero-initialized AttributeValue will cause a panic. -func (a AttributeValue) CopyTo(dest AttributeValue) { - dest.orig.Type = a.orig.Type - dest.orig.StringValue = a.orig.StringValue - dest.orig.IntValue = a.orig.IntValue - dest.orig.DoubleValue = a.orig.DoubleValue - dest.orig.BoolValue = a.orig.BoolValue +func (a AttributeValue) SetMapVal(m AttributeMap) { + if *a.orig == nil { + *a.orig = &otlpcommon.AnyValue{} + } + var dest *otlpcommon.KeyValueList + switch v := (*a.orig).Value.(type) { + case *otlpcommon.AnyValue_KvlistValue: + if v.KvlistValue == nil { + v.KvlistValue = &otlpcommon.KeyValueList{} + } + dest = v.KvlistValue + + default: + dest = &otlpcommon.KeyValueList{} + (*a.orig).Value = &otlpcommon.AnyValue_KvlistValue{KvlistValue: dest} + } + + destMap := newAttributeMap(&dest.Values) + destMap.InitFromAttributeMap(m) } -func (a AttributeValue) setTypeAndClear(ty otlpcommon.AttributeKeyValue_ValueType) { - a.orig.Type = ty - a.orig.StringValue = "" - a.orig.IntValue = 0 - a.orig.DoubleValue = 0.0 - a.orig.BoolValue = false +// copyTo copies the value to AnyValue. Will panic if dest is nil. +// Calling this function on zero-initialized AttributeValue will cause a panic. +func (a AttributeValue) copyTo(dest *otlpcommon.AnyValue) { + if *a.orig == nil { + // This is a null value. Make the dest null too. + dest.Value = nil + return + } + switch v := (*a.orig).Value.(type) { + case *otlpcommon.AnyValue_KvlistValue: + if v.KvlistValue == nil { + // Source is empty. + AttributeValue{&dest}.SetMapVal(NewAttributeMap()) + } else { + // Deep copy to dest. + AttributeValue{&dest}.SetMapVal(newAttributeMap(&v.KvlistValue.Values)) + } + case *otlpcommon.AnyValue_ArrayValue: + // TODO: handle ARRAY data type. We need to make a deep copy. + default: + // Primitive immutable type, no need for deep copy. + dest.Value = (*a.orig).Value + } } // Equal checks for equality, it returns true if the objects are equal otherwise false. func (a AttributeValue) Equal(av AttributeValue) bool { - return a.orig.Type == av.orig.Type && - a.orig.StringValue == av.orig.StringValue && - a.orig.IntValue == av.orig.IntValue && - a.orig.DoubleValue == av.orig.DoubleValue && - a.orig.BoolValue == av.orig.BoolValue + if (*a.orig) == nil || (*a.orig).Value == nil { + return (*av.orig) == nil || (*av.orig).Value == nil + } + if (*av.orig) == nil || (*av.orig).Value == nil { + return false + } + + switch v := (*a.orig).Value.(type) { + case *otlpcommon.AnyValue_StringValue: + return v.StringValue == (*av.orig).GetStringValue() + case *otlpcommon.AnyValue_BoolValue: + return v.BoolValue == (*av.orig).GetBoolValue() + case *otlpcommon.AnyValue_IntValue: + return v.IntValue == (*av.orig).GetIntValue() + case *otlpcommon.AnyValue_DoubleValue: + return v.DoubleValue == (*av.orig).GetDoubleValue() + } + // TODO: handle MAP and ARRAY data types. + return false } -func newAttributeKeyValueString(k string, v string) *otlpcommon.AttributeKeyValue { - akv := AttributeValue{&otlpcommon.AttributeKeyValue{Key: k}} +func newAttributeKeyValueString(k string, v string) *otlpcommon.KeyValue { + orig := &otlpcommon.KeyValue{Key: k, Value: &otlpcommon.AnyValue{}} + akv := AttributeValue{&orig.Value} akv.SetStringVal(v) - return akv.orig + return orig } -func newAttributeKeyValueInt(k string, v int64) *otlpcommon.AttributeKeyValue { - akv := AttributeValue{&otlpcommon.AttributeKeyValue{Key: k}} +func newAttributeKeyValueInt(k string, v int64) *otlpcommon.KeyValue { + orig := &otlpcommon.KeyValue{Key: k, Value: &otlpcommon.AnyValue{}} + akv := AttributeValue{&orig.Value} akv.SetIntVal(v) - return akv.orig + return orig } -func newAttributeKeyValueDouble(k string, v float64) *otlpcommon.AttributeKeyValue { - akv := AttributeValue{&otlpcommon.AttributeKeyValue{Key: k}} +func newAttributeKeyValueDouble(k string, v float64) *otlpcommon.KeyValue { + orig := &otlpcommon.KeyValue{Key: k, Value: &otlpcommon.AnyValue{}} + akv := AttributeValue{&orig.Value} akv.SetDoubleVal(v) - return akv.orig + return orig } -func newAttributeKeyValueBool(k string, v bool) *otlpcommon.AttributeKeyValue { - akv := AttributeValue{&otlpcommon.AttributeKeyValue{Key: k}} +func newAttributeKeyValueBool(k string, v bool) *otlpcommon.KeyValue { + orig := &otlpcommon.KeyValue{Key: k, Value: &otlpcommon.AnyValue{}} + akv := AttributeValue{&orig.Value} akv.SetBoolVal(v) - return akv.orig + return orig +} + +func newAttributeKeyValueNull(k string) *otlpcommon.KeyValue { + orig := &otlpcommon.KeyValue{Key: k, Value: &otlpcommon.AnyValue{}} + return orig } -func newAttributeKeyValue(k string, av AttributeValue) *otlpcommon.AttributeKeyValue { - akv := AttributeValue{&otlpcommon.AttributeKeyValue{Key: k}} - av.CopyTo(akv) - return akv.orig +func newAttributeKeyValue(k string, av AttributeValue) *otlpcommon.KeyValue { + orig := &otlpcommon.KeyValue{Key: k, Value: &otlpcommon.AnyValue{}} + av.copyTo(orig.Value) + return orig } // AttributeMap stores a map of attribute keys to values. type AttributeMap struct { - orig *[]*otlpcommon.AttributeKeyValue + orig *[]*otlpcommon.KeyValue } // NewAttributeMap creates a AttributeMap with 0 elements. func NewAttributeMap() AttributeMap { - orig := []*otlpcommon.AttributeKeyValue(nil) + orig := []*otlpcommon.KeyValue(nil) return AttributeMap{&orig} } -func newAttributeMap(orig *[]*otlpcommon.AttributeKeyValue) AttributeMap { +func newAttributeMap(orig *[]*otlpcommon.KeyValue) AttributeMap { return AttributeMap{orig} } @@ -244,16 +380,43 @@ func newAttributeMap(orig *[]*otlpcommon.AttributeKeyValue) AttributeMap { // assert.EqualValues(t, NewAttributeMap().InitFromMap(map[string]AttributeValue{...}), actual) func (am AttributeMap) InitFromMap(attrMap map[string]AttributeValue) AttributeMap { if len(attrMap) == 0 { - *am.orig = []*otlpcommon.AttributeKeyValue(nil) + *am.orig = []*otlpcommon.KeyValue(nil) return am } - origs := make([]otlpcommon.AttributeKeyValue, len(attrMap)) - wrappers := make([]*otlpcommon.AttributeKeyValue, len(attrMap)) + anyVals := make([]otlpcommon.AnyValue, len(attrMap)) + origs := make([]otlpcommon.KeyValue, len(attrMap)) + wrappers := make([]*otlpcommon.KeyValue, len(attrMap)) ix := 0 for k, v := range attrMap { + origs[ix].Value = &anyVals[ix] wrappers[ix] = &origs[ix] wrappers[ix].Key = k - v.CopyTo(AttributeValue{wrappers[ix]}) + v.copyTo(&anyVals[ix]) + ix++ + } + *am.orig = wrappers + return am +} + +// InitFromMap overwrites the entire AttributeMap and reconstructs the AttributeMap +// with values from the given map[string]string. +// +// Returns the same instance to allow nicer code like: +// assert.EqualValues(t, NewAttributeMap().InitFromMap(map[string]AttributeValue{...}), actual) +func (am AttributeMap) InitFromAttributeMap(attrMap AttributeMap) AttributeMap { + srcLen := attrMap.Len() + if srcLen == 0 || attrMap.orig == nil { + *am.orig = []*otlpcommon.KeyValue(nil) + return am + } + anyVals := make([]otlpcommon.AnyValue, srcLen) + origs := make([]otlpcommon.KeyValue, srcLen) + wrappers := make([]*otlpcommon.KeyValue, srcLen) + for ix, v := range *attrMap.orig { + origs[ix].Value = &anyVals[ix] + wrappers[ix] = &origs[ix] + wrappers[ix].Key = v.Key + AttributeValue{&v.Value}.copyTo(&anyVals[ix]) ix++ } *am.orig = wrappers @@ -263,18 +426,22 @@ func (am AttributeMap) InitFromMap(attrMap map[string]AttributeValue) AttributeM // InitEmptyWithCapacity constructs an empty AttributeMap with predefined slice capacity. func (am AttributeMap) InitEmptyWithCapacity(cap int) { if cap == 0 { - *am.orig = []*otlpcommon.AttributeKeyValue(nil) + *am.orig = []*otlpcommon.KeyValue(nil) } - *am.orig = make([]*otlpcommon.AttributeKeyValue, 0, cap) + *am.orig = make([]*otlpcommon.KeyValue, 0, cap) } -// Get returns the AttributeKeyValue associated with the key and true, -// otherwise an invalid instance of the AttributeKeyValue and false. +// Get returns the AttributeValue associated with the key and true. Returned +// AttributeValue is not a copy, it is a reference to the value stored in this map. +// It is allowed to modify the returned value using AttributeValue.Set* functions. +// Such modification will be applied to the value stored in this map. +// +// If the key does not exist returns an invalid instance of the KeyValue and false. // Calling any functions on the returned invalid instance will cause a panic. func (am AttributeMap) Get(key string) (AttributeValue, bool) { for _, a := range *am.orig { if a != nil && a.Key == key { - return AttributeValue{a}, true + return AttributeValue{&a.Value}, true } } return AttributeValue{nil}, false @@ -306,6 +473,14 @@ func (am AttributeMap) Insert(k string, v AttributeValue) { } } +// Insert adds a null Value to the map when the key does not exist. +// No action is applied to the map where the key already exists. +func (am AttributeMap) InsertNull(k string) { + if _, existing := am.Get(k); !existing { + *am.orig = append(*am.orig, newAttributeKeyValueNull(k)) + } +} + // Insert adds the string Value to the map when the key does not exist. // No action is applied to the map where the key already exists. func (am AttributeMap) InsertString(k string, v string) { @@ -347,7 +522,7 @@ func (am AttributeMap) InsertBool(k string, v bool) { // the raw value to avoid an extra allocation. func (am AttributeMap) Update(k string, v AttributeValue) { if av, existing := am.Get(k); existing { - v.CopyTo(av) + v.copyTo(*av.orig) } } @@ -393,7 +568,7 @@ func (am AttributeMap) UpdateBool(k string, v bool) { // the raw value to avoid an extra allocation. func (am AttributeMap) Upsert(k string, v AttributeValue) { if av, existing := am.Get(k); existing { - v.CopyTo(av) + v.copyTo(*av.orig) } else { *am.orig = append(*am.orig, newAttributeKeyValue(k, v)) } @@ -474,7 +649,7 @@ func (am AttributeMap) ForEach(f func(k string, v AttributeValue)) { if kv == nil { continue } - f(kv.Key, AttributeValue{kv}) + f(kv.Key, AttributeValue{&kv.Value}) } } @@ -482,24 +657,34 @@ func (am AttributeMap) ForEach(f func(k string, v AttributeValue)) { func (am AttributeMap) CopyTo(dest AttributeMap) { newLen := len(*am.orig) if newLen == 0 { - *dest.orig = []*otlpcommon.AttributeKeyValue(nil) + *dest.orig = []*otlpcommon.KeyValue(nil) return } + oldLen := len(*dest.orig) if newLen <= oldLen { + // New slice fits in existing slice, no need to reallocate. *dest.orig = (*dest.orig)[:newLen] - for i, kv := range *am.orig { - (*dest.orig)[i].Key = kv.Key - AttributeValue{kv}.CopyTo(AttributeValue{(*dest.orig)[i]}) + for i, srcAkv := range *am.orig { + destAkv := (*dest.orig)[i] + destAkv.Key = srcAkv.Key + if destAkv.Value == nil { + destAkv.Value = &otlpcommon.AnyValue{} + } + AttributeValue{&srcAkv.Value}.copyTo(destAkv.Value) } return } - origs := make([]otlpcommon.AttributeKeyValue, len(*am.orig)) - wrappers := make([]*otlpcommon.AttributeKeyValue, len(*am.orig)) + + // New slice is bigger than exist slice. Allocate new space. + anyVals := make([]otlpcommon.AnyValue, len(*am.orig)) + origs := make([]otlpcommon.KeyValue, len(*am.orig)) + wrappers := make([]*otlpcommon.KeyValue, len(*am.orig)) for i, kv := range *am.orig { + origs[i].Value = &anyVals[i] wrappers[i] = &origs[i] wrappers[i].Key = kv.Key - AttributeValue{kv}.CopyTo(AttributeValue{wrappers[i]}) + AttributeValue{&kv.Value}.copyTo(&anyVals[i]) } *dest.orig = wrappers } diff --git a/consumer/pdata/common_test.go b/consumer/pdata/common_test.go index 1421f6a1db05..790963db75fc 100644 --- a/consumer/pdata/common_test.go +++ b/consumer/pdata/common_test.go @@ -15,11 +15,13 @@ package pdata import ( + "encoding/json" "math/rand" "strconv" "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" otlpcommon "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" ) @@ -41,6 +43,9 @@ func TestAttributeValue(t *testing.T) { assert.EqualValues(t, AttributeValueBOOL, v.Type()) assert.EqualValues(t, true, v.BoolVal()) + v = NewAttributeValueNull() + assert.EqualValues(t, AttributeValueNULL, v.Type()) + v.SetStringVal("abc") assert.EqualValues(t, AttributeValueSTRING, v.Type()) assert.EqualValues(t, "abc", v.StringVal()) @@ -58,6 +63,214 @@ func TestAttributeValue(t *testing.T) { assert.EqualValues(t, true, v.BoolVal()) } +func fromVal(v interface{}) AttributeValue { + switch val := v.(type) { + case string: + return NewAttributeValueString(val) + case int: + return NewAttributeValueInt(int64(val)) + case float64: + return NewAttributeValueDouble(val) + case map[string]interface{}: + return fromMap(val) + } + return NewAttributeValueNull() +} + +func fromMap(v map[string]interface{}) AttributeValue { + m := NewAttributeMap() + for k, v := range v { + m.Insert(k, fromVal(v)) + } + m.Sort() + av := NewAttributeValueMap() + av.SetMapVal(m) + return av +} + +func fromJSON(jsonStr string) AttributeValue { + var src map[string]interface{} + err := json.Unmarshal([]byte(jsonStr), &src) + if err != nil { + panic("Invalid input jsonStr:" + jsonStr) + } + return fromMap(src) +} + +func assertMapJSON(t *testing.T, expectedJSON string, actualMap AttributeValue) { + assert.EqualValues(t, fromJSON(expectedJSON).MapVal(), actualMap.MapVal().Sort()) +} + +func TestAttributeValueMap(t *testing.T) { + m1 := NewAttributeValueMap() + assert.EqualValues(t, fromJSON(`{}`), m1) + assert.EqualValues(t, AttributeValueMAP, m1.Type()) + assert.EqualValues(t, NewAttributeMap(), m1.MapVal()) + assert.EqualValues(t, 0, m1.MapVal().Len()) + + m1.MapVal().InsertDouble("double_key", 123) + assertMapJSON(t, `{"double_key":123}`, m1) + assert.EqualValues(t, 1, m1.MapVal().Len()) + + v, exists := m1.MapVal().Get("double_key") + require.True(t, exists) + assert.EqualValues(t, AttributeValueDOUBLE, v.Type()) + assert.EqualValues(t, 123, v.DoubleVal()) + + // Create a second map. + m2 := NewAttributeValueMap() + assertMapJSON(t, `{}`, m2) + assert.EqualValues(t, 0, m2.MapVal().Len()) + + // Modify the source map that was inserted. + m2.MapVal().UpsertString("key_in_child", "somestr") + assertMapJSON(t, `{"key_in_child": "somestr"}`, m2) + assert.EqualValues(t, 1, m2.MapVal().Len()) + + // Insert the second map as a child. This should perform a deep copy. + m1.MapVal().Insert("child_map", m2) + assertMapJSON(t, `{"double_key":123, "child_map": {"key_in_child": "somestr"}}`, m1) + assert.EqualValues(t, 2, m1.MapVal().Len()) + + // Check that the map was correctly copied. + childMap, exists := m1.MapVal().Get("child_map") + require.True(t, exists) + assert.EqualValues(t, AttributeValueMAP, childMap.Type()) + assert.EqualValues(t, 1, childMap.MapVal().Len()) + + v, exists = childMap.MapVal().Get("key_in_child") + require.True(t, exists) + assert.EqualValues(t, AttributeValueSTRING, v.Type()) + assert.EqualValues(t, "somestr", v.StringVal()) + + // Modify the source map m2 that was inserted into m1. + m2.MapVal().UpdateString("key_in_child", "somestr2") + assertMapJSON(t, `{"key_in_child": "somestr2"}`, m2) + assert.EqualValues(t, 1, m2.MapVal().Len()) + + // The child map inside m1 should not be modified. + assertMapJSON(t, `{"double_key":123, "child_map": {"key_in_child": "somestr"}}`, m1) + childMap, exists = m1.MapVal().Get("child_map") + require.True(t, exists) + v, exists = childMap.MapVal().Get("key_in_child") + require.True(t, exists) + assert.EqualValues(t, AttributeValueSTRING, v.Type()) + assert.EqualValues(t, "somestr", v.StringVal()) + + // Now modify the inserted map (not the source) + childMap.MapVal().UpdateString("key_in_child", "somestr3") + assertMapJSON(t, `{"double_key":123, "child_map": {"key_in_child": "somestr3"}}`, m1) + assert.EqualValues(t, 1, childMap.MapVal().Len()) + + v, exists = childMap.MapVal().Get("key_in_child") + require.True(t, exists) + assert.EqualValues(t, AttributeValueSTRING, v.Type()) + assert.EqualValues(t, "somestr3", v.StringVal()) + + // The source child map should not be modified. + v, exists = m2.MapVal().Get("key_in_child") + require.True(t, exists) + assert.EqualValues(t, AttributeValueSTRING, v.Type()) + assert.EqualValues(t, "somestr2", v.StringVal()) + + deleted := m1.MapVal().Delete("double_key") + assert.True(t, deleted) + assertMapJSON(t, `{"child_map": {"key_in_child": "somestr3"}}`, m1) + assert.EqualValues(t, 1, m1.MapVal().Len()) + _, exists = m1.MapVal().Get("double_key") + assert.False(t, exists) + + deleted = m1.MapVal().Delete("child_map") + assert.True(t, deleted) + assert.EqualValues(t, 0, m1.MapVal().Len()) + _, exists = m1.MapVal().Get("child_map") + assert.False(t, exists) + + // Test nil KvlistValue case for MapVal() func. + orig := &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_KvlistValue{KvlistValue: nil}} + m1 = AttributeValue{orig: &orig} + assert.EqualValues(t, NewAttributeMap(), m1.MapVal()) +} + +func createNilOrigSetAttributeValue() AttributeValue { + var orig *otlpcommon.AnyValue + return AttributeValue{orig: &orig} +} + +func TestNilOrigSetAttributeValue(t *testing.T) { + av := createNilOrigSetAttributeValue() + av.SetStringVal("abc") + assert.EqualValues(t, "abc", av.StringVal()) + + av = createNilOrigSetAttributeValue() + av.SetIntVal(123) + assert.EqualValues(t, 123, av.IntVal()) + + av = createNilOrigSetAttributeValue() + av.SetBoolVal(true) + assert.EqualValues(t, true, av.BoolVal()) + + av = createNilOrigSetAttributeValue() + av.SetDoubleVal(1.23) + assert.EqualValues(t, 1.23, av.DoubleVal()) + + av = createNilOrigSetAttributeValue() + av.SetMapVal(NewAttributeMap()) + assert.EqualValues(t, NewAttributeMap(), av.MapVal()) + + // Test nil KvlistValue case for MapVal() func. + orig := &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_KvlistValue{KvlistValue: nil}} + av = AttributeValue{orig: &orig} + av.SetMapVal(NewAttributeMap()) + assert.EqualValues(t, NewAttributeMap(), av.MapVal()) +} + +func TestAttributeValueEqual(t *testing.T) { + av1 := createNilOrigSetAttributeValue() + av2 := createNilOrigSetAttributeValue() + assert.True(t, av1.Equal(av2)) + + av2 = NewAttributeValueString("abc") + assert.False(t, av1.Equal(av2)) + assert.False(t, av2.Equal(av1)) + + av1 = NewAttributeValueString("abc") + assert.True(t, av1.Equal(av2)) + + av2 = NewAttributeValueString("edf") + assert.False(t, av1.Equal(av2)) + + av2 = NewAttributeValueInt(123) + assert.False(t, av1.Equal(av2)) + assert.False(t, av2.Equal(av1)) + + av1 = NewAttributeValueInt(234) + assert.False(t, av1.Equal(av2)) + + av1 = NewAttributeValueInt(123) + assert.True(t, av1.Equal(av2)) + + av2 = NewAttributeValueDouble(123) + assert.False(t, av1.Equal(av2)) + assert.False(t, av2.Equal(av1)) + + av1 = NewAttributeValueDouble(234) + assert.False(t, av1.Equal(av2)) + + av1 = NewAttributeValueDouble(123) + assert.True(t, av1.Equal(av2)) + + av2 = NewAttributeValueBool(true) + assert.False(t, av1.Equal(av2)) + assert.False(t, av2.Equal(av1)) + + av1 = NewAttributeValueBool(true) + assert.True(t, av1.Equal(av2)) + + av1 = NewAttributeValueBool(false) + assert.False(t, av1.Equal(av2)) +} + func TestNewAttributeValueSlice(t *testing.T) { events := NewAttributeValueSlice(0) assert.EqualValues(t, 0, len(events)) @@ -85,6 +298,10 @@ func TestNilAttributeMap(t *testing.T) { insertMapString.InsertString("k", "v") assert.EqualValues(t, generateTestAttributeMap(), insertMapString) + insertMapNull := NewAttributeMap() + insertMapNull.InsertNull("k") + assert.EqualValues(t, generateTestNullAttributeMap(), insertMapNull) + insertMapInt := NewAttributeMap() insertMapInt.InsertInt("k", 123) assert.EqualValues(t, generateTestIntAttributeMap(), insertMapInt) @@ -146,120 +363,159 @@ func TestNilAttributeMap(t *testing.T) { } func TestAttributeMapWithNilValues(t *testing.T) { - origWithNil := []*otlpcommon.AttributeKeyValue{ + origWithNil := []*otlpcommon.KeyValue{ + nil, + { + Key: "test_key", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "test_value"}}, + }, nil, { - Key: "test_key", - Type: otlpcommon.AttributeKeyValue_STRING, - StringValue: "test_value", + Key: "test_key2", + Value: nil, }, nil, + { + Key: "test_key3", + Value: &otlpcommon.AnyValue{Value: nil}, + }, } sm := AttributeMap{ orig: &origWithNil, } val, exist := sm.Get("test_key") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "test_value", val.StringVal()) + val, exist = sm.Get("test_key2") + assert.True(t, exist) + assert.EqualValues(t, AttributeValueNULL, val.Type()) + assert.EqualValues(t, "", val.StringVal()) + + val, exist = sm.Get("test_key3") + assert.True(t, exist) + assert.EqualValues(t, AttributeValueNULL, val.Type()) + assert.EqualValues(t, "", val.StringVal()) + sm.Insert("other_key", NewAttributeValueString("other_value")) val, exist = sm.Get("other_key") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "other_value", val.StringVal()) sm.InsertString("other_key_string", "other_value") val, exist = sm.Get("other_key") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "other_value", val.StringVal()) sm.InsertInt("other_key_int", 123) val, exist = sm.Get("other_key_int") assert.True(t, exist) + assert.EqualValues(t, AttributeValueINT, val.Type()) assert.EqualValues(t, 123, val.IntVal()) sm.InsertDouble("other_key_double", 1.23) val, exist = sm.Get("other_key_double") assert.True(t, exist) + assert.EqualValues(t, AttributeValueDOUBLE, val.Type()) assert.EqualValues(t, 1.23, val.DoubleVal()) sm.InsertBool("other_key_bool", true) val, exist = sm.Get("other_key_bool") assert.True(t, exist) + assert.EqualValues(t, AttributeValueBOOL, val.Type()) assert.EqualValues(t, true, val.BoolVal()) sm.Update("other_key", NewAttributeValueString("yet_another_value")) val, exist = sm.Get("other_key") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "yet_another_value", val.StringVal()) sm.UpdateString("other_key_string", "yet_another_value") val, exist = sm.Get("other_key_string") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "yet_another_value", val.StringVal()) sm.UpdateInt("other_key_int", 456) val, exist = sm.Get("other_key_int") assert.True(t, exist) + assert.EqualValues(t, AttributeValueINT, val.Type()) assert.EqualValues(t, 456, val.IntVal()) sm.UpdateDouble("other_key_double", 4.56) val, exist = sm.Get("other_key_double") assert.True(t, exist) + assert.EqualValues(t, AttributeValueDOUBLE, val.Type()) assert.EqualValues(t, 4.56, val.DoubleVal()) sm.UpdateBool("other_key_bool", false) val, exist = sm.Get("other_key_bool") assert.True(t, exist) + assert.EqualValues(t, AttributeValueBOOL, val.Type()) assert.EqualValues(t, false, val.BoolVal()) sm.Upsert("other_key", NewAttributeValueString("other_value")) val, exist = sm.Get("other_key") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "other_value", val.StringVal()) sm.UpsertString("other_key_string", "other_value") val, exist = sm.Get("other_key") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "other_value", val.StringVal()) sm.UpsertInt("other_key_int", 123) val, exist = sm.Get("other_key_int") assert.True(t, exist) + assert.EqualValues(t, AttributeValueINT, val.Type()) assert.EqualValues(t, 123, val.IntVal()) sm.UpsertDouble("other_key_double", 1.23) val, exist = sm.Get("other_key_double") assert.True(t, exist) + assert.EqualValues(t, AttributeValueDOUBLE, val.Type()) assert.EqualValues(t, 1.23, val.DoubleVal()) sm.UpsertBool("other_key_bool", true) val, exist = sm.Get("other_key_bool") assert.True(t, exist) + assert.EqualValues(t, AttributeValueBOOL, val.Type()) assert.EqualValues(t, true, val.BoolVal()) sm.Upsert("yet_another_key", NewAttributeValueString("yet_another_value")) val, exist = sm.Get("yet_another_key") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "yet_another_value", val.StringVal()) sm.UpsertString("yet_another_key_string", "yet_another_value") val, exist = sm.Get("yet_another_key_string") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "yet_another_value", val.StringVal()) sm.UpsertInt("yet_another_key_int", 456) val, exist = sm.Get("yet_another_key_int") assert.True(t, exist) + assert.EqualValues(t, AttributeValueINT, val.Type()) assert.EqualValues(t, 456, val.IntVal()) sm.UpsertDouble("yet_another_key_double", 4.56) val, exist = sm.Get("yet_another_key_double") assert.True(t, exist) + assert.EqualValues(t, AttributeValueDOUBLE, val.Type()) assert.EqualValues(t, 4.56, val.DoubleVal()) sm.UpsertBool("yet_another_key_bool", false) val, exist = sm.Get("yet_another_key_bool") assert.True(t, exist) + assert.EqualValues(t, AttributeValueBOOL, val.Type()) assert.EqualValues(t, false, val.BoolVal()) assert.True(t, sm.Delete("other_key")) @@ -278,8 +534,19 @@ func TestAttributeMapWithNilValues(t *testing.T) { // Test that the initial key is still there. val, exist = sm.Get("test_key") assert.True(t, exist) + assert.EqualValues(t, AttributeValueSTRING, val.Type()) assert.EqualValues(t, "test_value", val.StringVal()) + val, exist = sm.Get("test_key2") + assert.True(t, exist) + assert.EqualValues(t, AttributeValueNULL, val.Type()) + assert.EqualValues(t, "", val.StringVal()) + + val, exist = sm.Get("test_key3") + assert.True(t, exist) + assert.EqualValues(t, AttributeValueNULL, val.Type()) + assert.EqualValues(t, "", val.StringVal()) + // Test Sort assert.EqualValues(t, AttributeMap{orig: &origWithNil}, sm.Sort()) } @@ -297,9 +564,10 @@ func TestAttributeMap_ForEach(t *testing.T) { "k_int": NewAttributeValueInt(123), "k_double": NewAttributeValueDouble(1.23), "k_bool": NewAttributeValueBool(true), + "k_null": NewAttributeValueNull(), } am := NewAttributeMap().InitFromMap(rawMap) - assert.EqualValues(t, 4, am.Len()) + assert.EqualValues(t, 5, am.Len()) am.ForEach(func(k string, v AttributeValue) { assert.True(t, v.Equal(rawMap[k])) @@ -314,8 +582,10 @@ func TestAttributeMap_ForEach_WithNils(t *testing.T) { "k_int": NewAttributeValueInt(123), "k_double": NewAttributeValueDouble(1.23), "k_bool": NewAttributeValueBool(true), + "k_null": NewAttributeValueNull(), + "k_null2": NewAttributeValueNull(), } - rawOrigWithNil := []*otlpcommon.AttributeKeyValue{ + rawOrigWithNil := []*otlpcommon.KeyValue{ nil, newAttributeKeyValueString("k_string", "123"), nil, @@ -325,11 +595,15 @@ func TestAttributeMap_ForEach_WithNils(t *testing.T) { nil, newAttributeKeyValueBool("k_bool", true), nil, + newAttributeKeyValueNull("k_null"), + nil, + {Key: "k_null2", Value: nil}, + nil, } am := AttributeMap{ orig: &rawOrigWithNil, } - assert.EqualValues(t, 9, am.Len()) + assert.EqualValues(t, 13, am.Len()) am.ForEach(func(k string, v AttributeValue) { assert.True(t, v.Equal(rawMap[k])) @@ -347,12 +621,14 @@ func TestAttributeMap_InitFromMap(t *testing.T) { "k_int": NewAttributeValueInt(123), "k_double": NewAttributeValueDouble(1.23), "k_bool": NewAttributeValueBool(true), + "k_null": NewAttributeValueNull(), } - rawOrig := []*otlpcommon.AttributeKeyValue{ + rawOrig := []*otlpcommon.KeyValue{ newAttributeKeyValueString("k_string", "123"), newAttributeKeyValueInt("k_int", 123), newAttributeKeyValueDouble("k_double", 1.23), newAttributeKeyValueBool("k_bool", true), + newAttributeKeyValueNull("k_null"), } am = NewAttributeMap().InitFromMap(rawMap) assert.EqualValues(t, AttributeMap{orig: &rawOrig}.Sort(), am.Sort()) @@ -371,6 +647,74 @@ func TestAttributeMap_CopyTo(t *testing.T) { // Test CopyTo same size slice generateTestAttributeMap().CopyTo(dest) assert.EqualValues(t, generateTestAttributeMap(), dest) + + // Test CopyTo with a nil Value in the destination + (*dest.orig)[0].Value = nil + generateTestAttributeMap().CopyTo(dest) + assert.EqualValues(t, generateTestAttributeMap(), dest) +} + +func TestAttributeValue_copyTo(t *testing.T) { + av := createNilOrigSetAttributeValue() + destVal := otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_IntValue{}} + av.copyTo(&destVal) + assert.EqualValues(t, nil, destVal.Value) +} + +func TestAttributeMap_UpdateWithNilValues(t *testing.T) { + origWithNil := []*otlpcommon.KeyValue{ + nil, + { + Key: "test_key", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "test_value"}}, + }, + nil, + { + Key: "test_key2", + Value: nil, + }, + nil, + { + Key: "test_key3", + Value: &otlpcommon.AnyValue{Value: nil}, + }, + } + sm := AttributeMap{ + orig: &origWithNil, + } + + av, exists := sm.Get("test_key") + assert.True(t, exists) + assert.EqualValues(t, AttributeValueSTRING, av.Type()) + assert.EqualValues(t, "test_value", av.StringVal()) + av.SetIntVal(123) + + av2, exists := sm.Get("test_key") + assert.True(t, exists) + assert.EqualValues(t, AttributeValueINT, av2.Type()) + assert.EqualValues(t, 123, av2.IntVal()) + + av, exists = sm.Get("test_key2") + assert.True(t, exists) + assert.EqualValues(t, AttributeValueNULL, av.Type()) + assert.EqualValues(t, "", av.StringVal()) + av.SetIntVal(123) + + av2, exists = sm.Get("test_key2") + assert.True(t, exists) + assert.EqualValues(t, AttributeValueINT, av2.Type()) + assert.EqualValues(t, 123, av2.IntVal()) + + av, exists = sm.Get("test_key3") + assert.True(t, exists) + assert.EqualValues(t, AttributeValueNULL, av.Type()) + assert.EqualValues(t, "", av.StringVal()) + av.SetBoolVal(true) + + av2, exists = sm.Get("test_key3") + assert.True(t, exists) + assert.EqualValues(t, AttributeValueBOOL, av2.Type()) + assert.EqualValues(t, true, av2.BoolVal()) } func TestNilStringMap(t *testing.T) { @@ -605,7 +949,7 @@ func BenchmarkAttributeValue_CopyTo(b *testing.B) { b.ResetTimer() for n := 0; n < b.N; n++ { - c.CopyTo(av) + c.copyTo(*av.orig) } if av.IntVal() != 123 { b.Fail() @@ -626,11 +970,11 @@ func BenchmarkAttributeValue_SetIntVal(b *testing.B) { func BenchmarkAttributeMap_ForEach(b *testing.B) { const numElements = 20 - rawOrigWithNil := make([]*otlpcommon.AttributeKeyValue, 2*numElements) + rawOrigWithNil := make([]*otlpcommon.KeyValue, 2*numElements) for i := 0; i < numElements; i++ { - rawOrigWithNil[i*2] = &otlpcommon.AttributeKeyValue{ - Key: "k" + strconv.Itoa(i), - StringValue: "v" + strconv.Itoa(i), + rawOrigWithNil[i*2] = &otlpcommon.KeyValue{ + Key: "k" + strconv.Itoa(i), + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "v" + strconv.Itoa(i)}}, } } am := AttributeMap{ @@ -741,6 +1085,13 @@ func fillTestAttributeMap(dest AttributeMap) { }) } +func generateTestNullAttributeMap() AttributeMap { + am := NewAttributeMap() + am.InitFromMap(map[string]AttributeValue{ + "k": NewAttributeValueNull(), + }) + return am +} func generateTestIntAttributeMap() AttributeMap { am := NewAttributeMap() am.InitFromMap(map[string]AttributeValue{ diff --git a/exporter/fileexporter/file_exporter_test.go b/exporter/fileexporter/file_exporter_test.go index 36a7f4774509..b3c5cfbbe280 100644 --- a/exporter/fileexporter/file_exporter_test.go +++ b/exporter/fileexporter/file_exporter_test.go @@ -170,11 +170,10 @@ func TestFileLogsExporterNoErrors(t *testing.T) { ld := []*logspb.ResourceLogs{ { Resource: &otresourcepb.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "attr1", - Type: otlpcommon.AttributeKeyValue_STRING, - StringValue: "value1", + Key: "attr1", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "value1"}}, }, }, }, @@ -191,11 +190,10 @@ func TestFileLogsExporterNoErrors(t *testing.T) { }, { Resource: &otresourcepb.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "attr2", - Type: otlpcommon.AttributeKeyValue_STRING, - StringValue: "value2", + Key: "attr2", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "value2"}}, }, }, }, @@ -219,8 +217,10 @@ func TestFileLogsExporterNoErrors(t *testing.T) { "resource": map[string]interface{}{ "attributes": []interface{}{ map[string]interface{}{ - "key": "attr1", - "stringValue": "value1", + "key": "attr1", + "value": map[string]interface{}{ + "stringValue": "value1", + }, }, }, }, @@ -243,8 +243,10 @@ func TestFileLogsExporterNoErrors(t *testing.T) { "resource": map[string]interface{}{ "attributes": []interface{}{ map[string]interface{}{ - "key": "attr2", - "stringValue": "value2", + "key": "attr2", + "value": map[string]interface{}{ + "stringValue": "value2", + }, }, }, }, @@ -263,11 +265,10 @@ func TestFileLogsExporterErrors(t *testing.T) { ld := []*logspb.ResourceLogs{ { Resource: &otresourcepb.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "attr1", - Type: otlpcommon.AttributeKeyValue_STRING, - StringValue: "value1", + Key: "attr1", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "value1"}}, }, }, }, @@ -284,11 +285,10 @@ func TestFileLogsExporterErrors(t *testing.T) { }, { Resource: &otresourcepb.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "attr2", - Type: otlpcommon.AttributeKeyValue_STRING, - StringValue: "value2", + Key: "attr2", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "value2"}}, }, }, }, diff --git a/internal/data/logsproto/logs/v1/logs.proto b/internal/data/logsproto/logs/v1/logs.proto index bc6ac97e42d3..fbce7e1301b2 100644 --- a/internal/data/logsproto/logs/v1/logs.proto +++ b/internal/data/logsproto/logs/v1/logs.proto @@ -135,6 +135,6 @@ message LogRecord { string body = 8; // Additional attributes that describe the specific event occurrence. Optional. - repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 9; + repeated opentelemetry.proto.common.v1.KeyValue attributes = 9; uint32 dropped_attributes_count = 10; } diff --git a/internal/data/metric_test.go b/internal/data/metric_test.go index d2311a9c9465..674f12665d99 100644 --- a/internal/data/metric_test.go +++ b/internal/data/metric_test.go @@ -763,11 +763,10 @@ func BenchmarkOtlpToFromInternal_SummaryPoints_MutateOneLabel(b *testing.B) { func generateTestProtoResource() *otlpresource.Resource { return &otlpresource.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "string", - Type: otlpcommon.AttributeKeyValue_STRING, - StringValue: "string-resource", + Key: "string", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "string-resource"}}, }, }, } diff --git a/internal/data/opentelemetry-proto b/internal/data/opentelemetry-proto index b54688569186..e43e1abc4042 160000 --- a/internal/data/opentelemetry-proto +++ b/internal/data/opentelemetry-proto @@ -1 +1 @@ -Subproject commit b54688569186e0b862bf7462a983ccf2c50c0547 +Subproject commit e43e1abc40428a6ee98e3bfd79bec1dfa2ed18cd diff --git a/internal/data/opentelemetry-proto-gen/collector/metrics/v1/metrics_service.pb.go b/internal/data/opentelemetry-proto-gen/collector/metrics/v1/metrics_service.pb.go index e3109bc8c49a..1f3de7c1042a 100644 --- a/internal/data/opentelemetry-proto-gen/collector/metrics/v1/metrics_service.pb.go +++ b/internal/data/opentelemetry-proto-gen/collector/metrics/v1/metrics_service.pb.go @@ -1,30 +1,21 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: opentelemetry/proto/collector/metrics/v1/metrics_service.proto -/* - Package v1 is a generated protocol buffer package. - - It is generated from these files: - opentelemetry/proto/collector/metrics/v1/metrics_service.proto - - It has these top-level messages: - ExportMetricsServiceRequest - ExportMetricsServiceResponse -*/ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import opentelemetry_proto_metrics_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) -import io "io" - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf @@ -34,7 +25,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ExportMetricsServiceRequest struct { // An array of ResourceMetrics. @@ -42,17 +33,43 @@ type ExportMetricsServiceRequest struct { // element. Intermediary nodes (such as OpenTelemetry Collector) that receive // data from multiple origins typically batch the data before forwarding further and // in that case this array will contain multiple elements. - ResourceMetrics []*opentelemetry_proto_metrics_v1.ResourceMetrics `protobuf:"bytes,1,rep,name=resource_metrics,json=resourceMetrics" json:"resource_metrics,omitempty"` + ResourceMetrics []*v1.ResourceMetrics `protobuf:"bytes,1,rep,name=resource_metrics,json=resourceMetrics,proto3" json:"resource_metrics,omitempty"` } func (m *ExportMetricsServiceRequest) Reset() { *m = ExportMetricsServiceRequest{} } func (m *ExportMetricsServiceRequest) String() string { return proto.CompactTextString(m) } func (*ExportMetricsServiceRequest) ProtoMessage() {} func (*ExportMetricsServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptorMetricsService, []int{0} + return fileDescriptor_75fb6015e6e64798, []int{0} +} +func (m *ExportMetricsServiceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExportMetricsServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExportMetricsServiceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExportMetricsServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportMetricsServiceRequest.Merge(m, src) +} +func (m *ExportMetricsServiceRequest) XXX_Size() int { + return m.Size() +} +func (m *ExportMetricsServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExportMetricsServiceRequest.DiscardUnknown(m) } -func (m *ExportMetricsServiceRequest) GetResourceMetrics() []*opentelemetry_proto_metrics_v1.ResourceMetrics { +var xxx_messageInfo_ExportMetricsServiceRequest proto.InternalMessageInfo + +func (m *ExportMetricsServiceRequest) GetResourceMetrics() []*v1.ResourceMetrics { if m != nil { return m.ResourceMetrics } @@ -66,14 +83,67 @@ func (m *ExportMetricsServiceResponse) Reset() { *m = ExportMetricsServi func (m *ExportMetricsServiceResponse) String() string { return proto.CompactTextString(m) } func (*ExportMetricsServiceResponse) ProtoMessage() {} func (*ExportMetricsServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptorMetricsService, []int{1} + return fileDescriptor_75fb6015e6e64798, []int{1} +} +func (m *ExportMetricsServiceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } +func (m *ExportMetricsServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExportMetricsServiceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExportMetricsServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportMetricsServiceResponse.Merge(m, src) +} +func (m *ExportMetricsServiceResponse) XXX_Size() int { + return m.Size() +} +func (m *ExportMetricsServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExportMetricsServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportMetricsServiceResponse proto.InternalMessageInfo func init() { proto.RegisterType((*ExportMetricsServiceRequest)(nil), "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest") proto.RegisterType((*ExportMetricsServiceResponse)(nil), "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse") } +func init() { + proto.RegisterFile("opentelemetry/proto/collector/metrics/v1/metrics_service.proto", fileDescriptor_75fb6015e6e64798) +} + +var fileDescriptor_75fb6015e6e64798 = []byte{ + // 292 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xcb, 0x2f, 0x48, 0xcd, + 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, + 0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x07, 0x89, 0x66, 0x26, 0x17, 0xeb, + 0x97, 0x19, 0xc2, 0x98, 0xf1, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x7a, 0x60, 0xa5, 0x42, + 0x1a, 0x28, 0xfa, 0x21, 0x82, 0x7a, 0x70, 0xfd, 0x7a, 0x50, 0x4d, 0x7a, 0x65, 0x86, 0x52, 0x3a, + 0xd8, 0x6c, 0xc2, 0x34, 0x1f, 0x62, 0x84, 0x52, 0x25, 0x97, 0xb4, 0x6b, 0x45, 0x41, 0x7e, 0x51, + 0x89, 0x2f, 0x44, 0x38, 0x18, 0x62, 0x6b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x14, + 0x97, 0x40, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x51, 0x72, 0x6a, 0x3c, 0x54, 0xa3, 0x04, 0xa3, 0x02, + 0xb3, 0x06, 0xb7, 0x91, 0xbe, 0x1e, 0x36, 0x17, 0x21, 0xdc, 0xa1, 0x17, 0x04, 0xd5, 0x07, 0x35, + 0x38, 0x88, 0xbf, 0x08, 0x55, 0x40, 0x49, 0x8e, 0x4b, 0x06, 0xbb, 0xd5, 0xc5, 0x05, 0xf9, 0x79, + 0xc5, 0xa9, 0x46, 0x6b, 0x18, 0xb9, 0xf8, 0x50, 0xa5, 0x84, 0x66, 0x32, 0x72, 0xb1, 0x41, 0xf4, + 0x08, 0xb9, 0xea, 0x11, 0x1b, 0x22, 0x7a, 0x78, 0x3c, 0x28, 0xe5, 0x46, 0xa9, 0x31, 0x10, 0xc7, + 0x2a, 0x31, 0x38, 0x6d, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, + 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x06, 0x2e, + 0xed, 0xcc, 0x7c, 0xa2, 0xad, 0x71, 0x12, 0x46, 0xb5, 0x21, 0x00, 0xa4, 0x32, 0x80, 0x31, 0x2a, + 0x22, 0x1d, 0xdd, 0x8c, 0x4c, 0xe4, 0x04, 0x94, 0x99, 0x57, 0x92, 0x5a, 0x94, 0x97, 0x98, 0xa3, + 0x9f, 0x92, 0x58, 0x92, 0xa8, 0x8f, 0xa2, 0x50, 0x17, 0x6c, 0x99, 0x6e, 0x7a, 0x6a, 0x1e, 0xd6, + 0x04, 0x97, 0xc4, 0x06, 0x96, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x0d, 0x4f, 0x39, + 0xa3, 0x02, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -82,8 +152,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for MetricsService service - +// MetricsServiceClient is the client API for MetricsService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MetricsServiceClient interface { // For performance reasons, it is recommended to keep this RPC // alive for the entire life of the application. @@ -100,21 +171,28 @@ func NewMetricsServiceClient(cc *grpc.ClientConn) MetricsServiceClient { func (c *metricsServiceClient) Export(ctx context.Context, in *ExportMetricsServiceRequest, opts ...grpc.CallOption) (*ExportMetricsServiceResponse, error) { out := new(ExportMetricsServiceResponse) - err := grpc.Invoke(ctx, "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for MetricsService service - +// MetricsServiceServer is the server API for MetricsService service. type MetricsServiceServer interface { // For performance reasons, it is recommended to keep this RPC // alive for the entire life of the application. Export(context.Context, *ExportMetricsServiceRequest) (*ExportMetricsServiceResponse, error) } +// UnimplementedMetricsServiceServer can be embedded to have forward compatible implementations. +type UnimplementedMetricsServiceServer struct { +} + +func (*UnimplementedMetricsServiceServer) Export(ctx context.Context, req *ExportMetricsServiceRequest) (*ExportMetricsServiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Export not implemented") +} + func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer) { s.RegisterService(&_MetricsService_serviceDesc, srv) } @@ -153,7 +231,7 @@ var _MetricsService_serviceDesc = grpc.ServiceDesc{ func (m *ExportMetricsServiceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -161,29 +239,36 @@ func (m *ExportMetricsServiceRequest) Marshal() (dAtA []byte, err error) { } func (m *ExportMetricsServiceRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExportMetricsServiceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.ResourceMetrics) > 0 { - for _, msg := range m.ResourceMetrics { - dAtA[i] = 0xa - i++ - i = encodeVarintMetricsService(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.ResourceMetrics) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceMetrics[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetricsService(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *ExportMetricsServiceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -191,41 +276,33 @@ func (m *ExportMetricsServiceResponse) Marshal() (dAtA []byte, err error) { } func (m *ExportMetricsServiceResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExportMetricsServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } -func encodeFixed64MetricsService(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32MetricsService(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintMetricsService(dAtA []byte, offset int, v uint64) int { + offset -= sovMetricsService(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ExportMetricsServiceRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.ResourceMetrics) > 0 { @@ -238,20 +315,16 @@ func (m *ExportMetricsServiceRequest) Size() (n int) { } func (m *ExportMetricsServiceResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l return n } func sovMetricsService(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozMetricsService(x uint64) (n int) { return sovMetricsService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -271,7 +344,7 @@ func (m *ExportMetricsServiceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -299,7 +372,7 @@ func (m *ExportMetricsServiceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -308,10 +381,13 @@ func (m *ExportMetricsServiceRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetricsService } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetricsService + } if postIndex > l { return io.ErrUnexpectedEOF } - m.ResourceMetrics = append(m.ResourceMetrics, &opentelemetry_proto_metrics_v1.ResourceMetrics{}) + m.ResourceMetrics = append(m.ResourceMetrics, &v1.ResourceMetrics{}) if err := m.ResourceMetrics[len(m.ResourceMetrics)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -325,6 +401,9 @@ func (m *ExportMetricsServiceRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetricsService } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetricsService + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -352,7 +431,7 @@ func (m *ExportMetricsServiceResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -375,6 +454,9 @@ func (m *ExportMetricsServiceResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetricsService } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetricsService + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -390,6 +472,7 @@ func (m *ExportMetricsServiceResponse) Unmarshal(dAtA []byte) error { func skipMetricsService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -421,10 +504,8 @@ func skipMetricsService(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -441,79 +522,34 @@ func skipMetricsService(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthMetricsService } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMetricsService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipMetricsService(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMetricsService + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthMetricsService + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthMetricsService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMetricsService = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthMetricsService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMetricsService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMetricsService = fmt.Errorf("proto: unexpected end of group") ) - -func init() { - proto.RegisterFile("opentelemetry/proto/collector/metrics/v1/metrics_service.proto", fileDescriptorMetricsService) -} - -var fileDescriptorMetricsService = []byte{ - // 284 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xcb, 0x2f, 0x48, 0xcd, - 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, - 0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x07, 0x89, 0x66, 0x26, 0x17, 0xeb, - 0x97, 0x19, 0xc2, 0x98, 0xf1, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x7a, 0x60, 0xa5, 0x42, - 0x1a, 0x28, 0xfa, 0x21, 0x82, 0x7a, 0x70, 0xfd, 0x7a, 0x50, 0x4d, 0x7a, 0x65, 0x86, 0x52, 0x3a, - 0xd8, 0x6c, 0xc2, 0x34, 0x1f, 0x62, 0x84, 0x52, 0x25, 0x97, 0xb4, 0x6b, 0x45, 0x41, 0x7e, 0x51, - 0x89, 0x2f, 0x44, 0x38, 0x18, 0x62, 0x6b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x14, - 0x97, 0x40, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x51, 0x72, 0x6a, 0x3c, 0x54, 0xa3, 0x04, 0xa3, 0x02, - 0xb3, 0x06, 0xb7, 0x91, 0xbe, 0x1e, 0x36, 0x17, 0x21, 0xdc, 0xa1, 0x17, 0x04, 0xd5, 0x07, 0x35, - 0x38, 0x88, 0xbf, 0x08, 0x55, 0x40, 0x49, 0x8e, 0x4b, 0x06, 0xbb, 0xd5, 0xc5, 0x05, 0xf9, 0x79, - 0xc5, 0xa9, 0x46, 0x6b, 0x18, 0xb9, 0xf8, 0x50, 0xa5, 0x84, 0x66, 0x32, 0x72, 0xb1, 0x41, 0xf4, - 0x08, 0xb9, 0xea, 0x11, 0x1b, 0x22, 0x7a, 0x78, 0x3c, 0x28, 0xe5, 0x46, 0xa9, 0x31, 0x10, 0xc7, - 0x2a, 0x31, 0x38, 0xad, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, - 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xe0, 0xd2, 0xce, 0xcc, 0x27, 0xda, 0x78, 0x27, 0x61, 0x54, - 0x93, 0x03, 0x40, 0x2a, 0x03, 0x18, 0xa3, 0x22, 0xd2, 0xd1, 0xcd, 0xc8, 0x44, 0x4e, 0x38, 0x99, - 0x79, 0x25, 0xa9, 0x45, 0x79, 0x89, 0x39, 0xfa, 0x29, 0x89, 0x25, 0x89, 0xfa, 0x28, 0x0a, 0x75, - 0xc1, 0x96, 0xe9, 0xa6, 0xa7, 0xe6, 0x61, 0x4d, 0x68, 0x49, 0x6c, 0x60, 0x79, 0x63, 0x40, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xec, 0xdf, 0xaa, 0x0c, 0x9b, 0x02, 0x00, 0x00, -} diff --git a/internal/data/opentelemetry-proto-gen/collector/trace/v1/trace_config.pb.go b/internal/data/opentelemetry-proto-gen/collector/trace/v1/trace_config.pb.go index db29af7b7cee..19ac860ef9eb 100644 --- a/internal/data/opentelemetry-proto-gen/collector/trace/v1/trace_config.pb.go +++ b/internal/data/opentelemetry-proto-gen/collector/trace/v1/trace_config.pb.go @@ -1,25 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: opentelemetry/proto/trace/v1/trace_config.proto -/* - Package v1 is a generated protocol buffer package. - - It is generated from these files: - opentelemetry/proto/trace/v1/trace_config.proto - - It has these top-level messages: - TraceConfig - ConstantSampler - ProbabilitySampler - RateLimitingSampler -*/ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" +import ( + encoding_binary "encoding/binary" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -30,7 +21,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // How spans should be sampled: // - Always off @@ -49,6 +40,7 @@ var ConstantSampler_ConstantDecision_name = map[int32]string{ 1: "ALWAYS_ON", 2: "ALWAYS_PARENT", } + var ConstantSampler_ConstantDecision_value = map[string]int32{ "ALWAYS_OFF": 0, "ALWAYS_ON": 1, @@ -58,8 +50,9 @@ var ConstantSampler_ConstantDecision_value = map[string]int32{ func (x ConstantSampler_ConstantDecision) String() string { return proto.EnumName(ConstantSampler_ConstantDecision_name, int32(x)) } + func (ConstantSampler_ConstantDecision) EnumDescriptor() ([]byte, []int) { - return fileDescriptorTraceConfig, []int{1, 0} + return fileDescriptor_5936aa8fa6443e6f, []int{1, 0} } // Global configuration of the trace service. All fields must be specified, or @@ -84,10 +77,38 @@ type TraceConfig struct { MaxNumberOfAttributesPerLink int64 `protobuf:"varint,8,opt,name=max_number_of_attributes_per_link,json=maxNumberOfAttributesPerLink,proto3" json:"max_number_of_attributes_per_link,omitempty"` } -func (m *TraceConfig) Reset() { *m = TraceConfig{} } -func (m *TraceConfig) String() string { return proto.CompactTextString(m) } -func (*TraceConfig) ProtoMessage() {} -func (*TraceConfig) Descriptor() ([]byte, []int) { return fileDescriptorTraceConfig, []int{0} } +func (m *TraceConfig) Reset() { *m = TraceConfig{} } +func (m *TraceConfig) String() string { return proto.CompactTextString(m) } +func (*TraceConfig) ProtoMessage() {} +func (*TraceConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{0} +} +func (m *TraceConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TraceConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TraceConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_TraceConfig.Merge(m, src) +} +func (m *TraceConfig) XXX_Size() int { + return m.Size() +} +func (m *TraceConfig) XXX_DiscardUnknown() { + xxx_messageInfo_TraceConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_TraceConfig proto.InternalMessageInfo type isTraceConfig_Sampler interface { isTraceConfig_Sampler() @@ -96,13 +117,13 @@ type isTraceConfig_Sampler interface { } type TraceConfig_ConstantSampler struct { - ConstantSampler *ConstantSampler `protobuf:"bytes,1,opt,name=constant_sampler,json=constantSampler,oneof"` + ConstantSampler *ConstantSampler `protobuf:"bytes,1,opt,name=constant_sampler,json=constantSampler,proto3,oneof" json:"constant_sampler,omitempty"` } type TraceConfig_ProbabilitySampler struct { - ProbabilitySampler *ProbabilitySampler `protobuf:"bytes,2,opt,name=probability_sampler,json=probabilitySampler,oneof"` + ProbabilitySampler *ProbabilitySampler `protobuf:"bytes,2,opt,name=probability_sampler,json=probabilitySampler,proto3,oneof" json:"probability_sampler,omitempty"` } type TraceConfig_RateLimitingSampler struct { - RateLimitingSampler *RateLimitingSampler `protobuf:"bytes,3,opt,name=rate_limiting_sampler,json=rateLimitingSampler,oneof"` + RateLimitingSampler *RateLimitingSampler `protobuf:"bytes,3,opt,name=rate_limiting_sampler,json=rateLimitingSampler,proto3,oneof" json:"rate_limiting_sampler,omitempty"` } func (*TraceConfig_ConstantSampler) isTraceConfig_Sampler() {} @@ -172,108 +193,52 @@ func (m *TraceConfig) GetMaxNumberOfAttributesPerLink() int64 { return 0 } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*TraceConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _TraceConfig_OneofMarshaler, _TraceConfig_OneofUnmarshaler, _TraceConfig_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TraceConfig) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*TraceConfig_ConstantSampler)(nil), (*TraceConfig_ProbabilitySampler)(nil), (*TraceConfig_RateLimitingSampler)(nil), } } -func _TraceConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*TraceConfig) - // sampler - switch x := m.Sampler.(type) { - case *TraceConfig_ConstantSampler: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ConstantSampler); err != nil { - return err - } - case *TraceConfig_ProbabilitySampler: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ProbabilitySampler); err != nil { - return err - } - case *TraceConfig_RateLimitingSampler: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.RateLimitingSampler); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("TraceConfig.Sampler has unexpected type %T", x) - } - return nil +// Sampler that always makes a constant decision on span sampling. +type ConstantSampler struct { + Decision ConstantSampler_ConstantDecision `protobuf:"varint,1,opt,name=decision,proto3,enum=opentelemetry.proto.trace.v1.ConstantSampler_ConstantDecision" json:"decision,omitempty"` } -func _TraceConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*TraceConfig) - switch tag { - case 1: // sampler.constant_sampler - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ConstantSampler) - err := b.DecodeMessage(msg) - m.Sampler = &TraceConfig_ConstantSampler{msg} - return true, err - case 2: // sampler.probability_sampler - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ProbabilitySampler) - err := b.DecodeMessage(msg) - m.Sampler = &TraceConfig_ProbabilitySampler{msg} - return true, err - case 3: // sampler.rate_limiting_sampler - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType +func (m *ConstantSampler) Reset() { *m = ConstantSampler{} } +func (m *ConstantSampler) String() string { return proto.CompactTextString(m) } +func (*ConstantSampler) ProtoMessage() {} +func (*ConstantSampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{1} +} +func (m *ConstantSampler) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConstantSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConstantSampler.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } - msg := new(RateLimitingSampler) - err := b.DecodeMessage(msg) - m.Sampler = &TraceConfig_RateLimitingSampler{msg} - return true, err - default: - return false, nil + return b[:n], nil } } - -func _TraceConfig_OneofSizer(msg proto.Message) (n int) { - m := msg.(*TraceConfig) - // sampler - switch x := m.Sampler.(type) { - case *TraceConfig_ConstantSampler: - s := proto.Size(x.ConstantSampler) - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *TraceConfig_ProbabilitySampler: - s := proto.Size(x.ProbabilitySampler) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *TraceConfig_RateLimitingSampler: - s := proto.Size(x.RateLimitingSampler) - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n +func (m *ConstantSampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConstantSampler.Merge(m, src) } - -// Sampler that always makes a constant decision on span sampling. -type ConstantSampler struct { - Decision ConstantSampler_ConstantDecision `protobuf:"varint,1,opt,name=decision,proto3,enum=opentelemetry.proto.trace.v1.ConstantSampler_ConstantDecision" json:"decision,omitempty"` +func (m *ConstantSampler) XXX_Size() int { + return m.Size() +} +func (m *ConstantSampler) XXX_DiscardUnknown() { + xxx_messageInfo_ConstantSampler.DiscardUnknown(m) } -func (m *ConstantSampler) Reset() { *m = ConstantSampler{} } -func (m *ConstantSampler) String() string { return proto.CompactTextString(m) } -func (*ConstantSampler) ProtoMessage() {} -func (*ConstantSampler) Descriptor() ([]byte, []int) { return fileDescriptorTraceConfig, []int{1} } +var xxx_messageInfo_ConstantSampler proto.InternalMessageInfo func (m *ConstantSampler) GetDecision() ConstantSampler_ConstantDecision { if m != nil { @@ -289,10 +254,38 @@ type ProbabilitySampler struct { SamplingProbability float64 `protobuf:"fixed64,1,opt,name=samplingProbability,proto3" json:"samplingProbability,omitempty"` } -func (m *ProbabilitySampler) Reset() { *m = ProbabilitySampler{} } -func (m *ProbabilitySampler) String() string { return proto.CompactTextString(m) } -func (*ProbabilitySampler) ProtoMessage() {} -func (*ProbabilitySampler) Descriptor() ([]byte, []int) { return fileDescriptorTraceConfig, []int{2} } +func (m *ProbabilitySampler) Reset() { *m = ProbabilitySampler{} } +func (m *ProbabilitySampler) String() string { return proto.CompactTextString(m) } +func (*ProbabilitySampler) ProtoMessage() {} +func (*ProbabilitySampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{2} +} +func (m *ProbabilitySampler) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProbabilitySampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProbabilitySampler.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProbabilitySampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProbabilitySampler.Merge(m, src) +} +func (m *ProbabilitySampler) XXX_Size() int { + return m.Size() +} +func (m *ProbabilitySampler) XXX_DiscardUnknown() { + xxx_messageInfo_ProbabilitySampler.DiscardUnknown(m) +} + +var xxx_messageInfo_ProbabilitySampler proto.InternalMessageInfo func (m *ProbabilitySampler) GetSamplingProbability() float64 { if m != nil { @@ -307,10 +300,38 @@ type RateLimitingSampler struct { Qps int64 `protobuf:"varint,1,opt,name=qps,proto3" json:"qps,omitempty"` } -func (m *RateLimitingSampler) Reset() { *m = RateLimitingSampler{} } -func (m *RateLimitingSampler) String() string { return proto.CompactTextString(m) } -func (*RateLimitingSampler) ProtoMessage() {} -func (*RateLimitingSampler) Descriptor() ([]byte, []int) { return fileDescriptorTraceConfig, []int{3} } +func (m *RateLimitingSampler) Reset() { *m = RateLimitingSampler{} } +func (m *RateLimitingSampler) String() string { return proto.CompactTextString(m) } +func (*RateLimitingSampler) ProtoMessage() {} +func (*RateLimitingSampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{3} +} +func (m *RateLimitingSampler) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimitingSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimitingSampler.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RateLimitingSampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimitingSampler.Merge(m, src) +} +func (m *RateLimitingSampler) XXX_Size() int { + return m.Size() +} +func (m *RateLimitingSampler) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimitingSampler.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimitingSampler proto.InternalMessageInfo func (m *RateLimitingSampler) GetQps() int64 { if m != nil { @@ -320,16 +341,59 @@ func (m *RateLimitingSampler) GetQps() int64 { } func init() { + proto.RegisterEnum("opentelemetry.proto.trace.v1.ConstantSampler_ConstantDecision", ConstantSampler_ConstantDecision_name, ConstantSampler_ConstantDecision_value) proto.RegisterType((*TraceConfig)(nil), "opentelemetry.proto.trace.v1.TraceConfig") proto.RegisterType((*ConstantSampler)(nil), "opentelemetry.proto.trace.v1.ConstantSampler") proto.RegisterType((*ProbabilitySampler)(nil), "opentelemetry.proto.trace.v1.ProbabilitySampler") proto.RegisterType((*RateLimitingSampler)(nil), "opentelemetry.proto.trace.v1.RateLimitingSampler") - proto.RegisterEnum("opentelemetry.proto.trace.v1.ConstantSampler_ConstantDecision", ConstantSampler_ConstantDecision_name, ConstantSampler_ConstantDecision_value) } + +func init() { + proto.RegisterFile("opentelemetry/proto/trace/v1/trace_config.proto", fileDescriptor_5936aa8fa6443e6f) +} + +var fileDescriptor_5936aa8fa6443e6f = []byte{ + // 543 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4f, 0x6f, 0xda, 0x30, + 0x18, 0xc6, 0x71, 0x59, 0xff, 0xbd, 0x55, 0xdb, 0xcc, 0xa8, 0x53, 0x34, 0x55, 0x59, 0x97, 0xcb, + 0xb8, 0x40, 0x4a, 0x77, 0x98, 0xb4, 0xc3, 0x24, 0x68, 0xcb, 0x76, 0x40, 0x14, 0xa5, 0x68, 0xd3, + 0xb8, 0x44, 0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, 0x65, 0xb3, 0x6d, + 0x6c, 0xd8, 0x75, 0xc0, 0xcb, 0x83, 0x89, 0x4f, 0xa1, 0xa0, 0xaf, 0xc5, 0x78, 0x90, 0x51, 0xf5, + 0x15, 0x90, 0xbb, 0x4a, 0xb2, 0xdf, 0x40, 0x61, 0xc5, 0xe4, 0x61, 0x03, 0xf2, 0xdf, 0xe3, 0x44, + 0x1b, 0xf3, 0x6e, 0xba, 0xac, 0xfd, 0x42, 0x7f, 0x86, 0x16, 0xba, 0x1f, 0x5a, 0xe8, 0xdf, 0xd0, + 0x42, 0x3f, 0x47, 0x56, 0xee, 0x7e, 0x64, 0xe5, 0xfe, 0x8e, 0xac, 0x1c, 0xbc, 0x62, 0x62, 0xed, + 0xaf, 0x53, 0x33, 0x32, 0xdf, 0x79, 0x2b, 0x95, 0x5a, 0xa8, 0xf3, 0x39, 0x58, 0x34, 0x31, 0xe1, + 0xf8, 0x22, 0x0c, 0xa9, 0xaf, 0x84, 0x74, 0x18, 0x57, 0x54, 0x72, 0x12, 0x3a, 0x3d, 0xa2, 0xc8, + 0xfc, 0xcb, 0x53, 0xd2, 0xf4, 0x52, 0x40, 0x79, 0x66, 0xff, 0xc3, 0x3b, 0xd4, 0xdd, 0xd2, 0xea, + 0xdb, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x71, 0xfd, 0x53, 0x41, 0xae, 0x04, 0x00, 0x00, +} + func (m *TraceConfig) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -337,91 +401,119 @@ func (m *TraceConfig) Marshal() (dAtA []byte, err error) { } func (m *TraceConfig) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Sampler != nil { - nn1, err := m.Sampler.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn1 - } - if m.MaxNumberOfAttributes != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfAttributes)) + if m.MaxNumberOfAttributesPerLink != 0 { + i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfAttributesPerLink)) + i-- + dAtA[i] = 0x40 } - if m.MaxNumberOfTimedEvents != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfTimedEvents)) + if m.MaxNumberOfLinks != 0 { + i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfLinks)) + i-- + dAtA[i] = 0x38 } if m.MaxNumberOfAttributesPerTimedEvent != 0 { - dAtA[i] = 0x30 - i++ i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfAttributesPerTimedEvent)) + i-- + dAtA[i] = 0x30 } - if m.MaxNumberOfLinks != 0 { - dAtA[i] = 0x38 - i++ - i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfLinks)) + if m.MaxNumberOfTimedEvents != 0 { + i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfTimedEvents)) + i-- + dAtA[i] = 0x28 } - if m.MaxNumberOfAttributesPerLink != 0 { - dAtA[i] = 0x40 - i++ - i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfAttributesPerLink)) + if m.MaxNumberOfAttributes != 0 { + i = encodeVarintTraceConfig(dAtA, i, uint64(m.MaxNumberOfAttributes)) + i-- + dAtA[i] = 0x20 + } + if m.Sampler != nil { + { + size := m.Sampler.Size() + i -= size + if _, err := m.Sampler.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } } - return i, nil + return len(dAtA) - i, nil } func (m *TraceConfig_ConstantSampler) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TraceConfig_ConstantSampler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.ConstantSampler != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTraceConfig(dAtA, i, uint64(m.ConstantSampler.Size())) - n2, err := m.ConstantSampler.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.ConstantSampler.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTraceConfig(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *TraceConfig_ProbabilitySampler) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TraceConfig_ProbabilitySampler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.ProbabilitySampler != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTraceConfig(dAtA, i, uint64(m.ProbabilitySampler.Size())) - n3, err := m.ProbabilitySampler.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.ProbabilitySampler.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTraceConfig(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *TraceConfig_RateLimitingSampler) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TraceConfig_RateLimitingSampler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.RateLimitingSampler != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTraceConfig(dAtA, i, uint64(m.RateLimitingSampler.Size())) - n4, err := m.RateLimitingSampler.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.RateLimitingSampler.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTraceConfig(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *ConstantSampler) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -429,22 +521,27 @@ func (m *ConstantSampler) Marshal() (dAtA []byte, err error) { } func (m *ConstantSampler) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConstantSampler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.Decision != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintTraceConfig(dAtA, i, uint64(m.Decision)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *ProbabilitySampler) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -452,22 +549,28 @@ func (m *ProbabilitySampler) Marshal() (dAtA []byte, err error) { } func (m *ProbabilitySampler) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProbabilitySampler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.SamplingProbability != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.SamplingProbability)))) + i-- dAtA[i] = 0x9 - i++ - i = encodeFixed64TraceConfig(dAtA, i, uint64(math.Float64bits(float64(m.SamplingProbability)))) } - return i, nil + return len(dAtA) - i, nil } func (m *RateLimitingSampler) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -475,46 +578,38 @@ func (m *RateLimitingSampler) Marshal() (dAtA []byte, err error) { } func (m *RateLimitingSampler) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RateLimitingSampler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.Qps != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintTraceConfig(dAtA, i, uint64(m.Qps)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } -func encodeFixed64TraceConfig(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32TraceConfig(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintTraceConfig(dAtA []byte, offset int, v uint64) int { + offset -= sovTraceConfig(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *TraceConfig) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Sampler != nil { @@ -539,6 +634,9 @@ func (m *TraceConfig) Size() (n int) { } func (m *TraceConfig_ConstantSampler) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ConstantSampler != nil { @@ -548,6 +646,9 @@ func (m *TraceConfig_ConstantSampler) Size() (n int) { return n } func (m *TraceConfig_ProbabilitySampler) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ProbabilitySampler != nil { @@ -557,6 +658,9 @@ func (m *TraceConfig_ProbabilitySampler) Size() (n int) { return n } func (m *TraceConfig_RateLimitingSampler) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.RateLimitingSampler != nil { @@ -566,6 +670,9 @@ func (m *TraceConfig_RateLimitingSampler) Size() (n int) { return n } func (m *ConstantSampler) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Decision != 0 { @@ -575,6 +682,9 @@ func (m *ConstantSampler) Size() (n int) { } func (m *ProbabilitySampler) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.SamplingProbability != 0 { @@ -584,6 +694,9 @@ func (m *ProbabilitySampler) Size() (n int) { } func (m *RateLimitingSampler) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Qps != 0 { @@ -593,14 +706,7 @@ func (m *RateLimitingSampler) Size() (n int) { } func sovTraceConfig(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTraceConfig(x uint64) (n int) { return sovTraceConfig(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -620,7 +726,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -648,7 +754,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -657,6 +763,9 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTraceConfig } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTraceConfig + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -680,7 +789,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -689,6 +798,9 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTraceConfig } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTraceConfig + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -712,7 +824,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -721,6 +833,9 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTraceConfig } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTraceConfig + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -744,7 +859,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxNumberOfAttributes |= (int64(b) & 0x7F) << shift + m.MaxNumberOfAttributes |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -763,7 +878,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxNumberOfTimedEvents |= (int64(b) & 0x7F) << shift + m.MaxNumberOfTimedEvents |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -782,7 +897,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxNumberOfAttributesPerTimedEvent |= (int64(b) & 0x7F) << shift + m.MaxNumberOfAttributesPerTimedEvent |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -801,7 +916,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxNumberOfLinks |= (int64(b) & 0x7F) << shift + m.MaxNumberOfLinks |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -820,7 +935,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxNumberOfAttributesPerLink |= (int64(b) & 0x7F) << shift + m.MaxNumberOfAttributesPerLink |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -834,6 +949,9 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTraceConfig } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTraceConfig + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -861,7 +979,7 @@ func (m *ConstantSampler) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -889,7 +1007,7 @@ func (m *ConstantSampler) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Decision |= (ConstantSampler_ConstantDecision(b) & 0x7F) << shift + m.Decision |= ConstantSampler_ConstantDecision(b&0x7F) << shift if b < 0x80 { break } @@ -903,6 +1021,9 @@ func (m *ConstantSampler) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTraceConfig } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTraceConfig + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -930,7 +1051,7 @@ func (m *ProbabilitySampler) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -952,15 +1073,8 @@ func (m *ProbabilitySampler) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 m.SamplingProbability = float64(math.Float64frombits(v)) default: iNdEx = preIndex @@ -971,6 +1085,9 @@ func (m *ProbabilitySampler) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTraceConfig } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTraceConfig + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -998,7 +1115,7 @@ func (m *RateLimitingSampler) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1026,7 +1143,7 @@ func (m *RateLimitingSampler) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Qps |= (int64(b) & 0x7F) << shift + m.Qps |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -1040,6 +1157,9 @@ func (m *RateLimitingSampler) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTraceConfig } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTraceConfig + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1055,6 +1175,7 @@ func (m *RateLimitingSampler) Unmarshal(dAtA []byte) error { func skipTraceConfig(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1086,10 +1207,8 @@ func skipTraceConfig(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1106,95 +1225,34 @@ func skipTraceConfig(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthTraceConfig } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTraceConfig - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTraceConfig(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTraceConfig + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTraceConfig + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTraceConfig = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTraceConfig = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTraceConfig = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTraceConfig = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTraceConfig = fmt.Errorf("proto: unexpected end of group") ) - -func init() { - proto.RegisterFile("opentelemetry/proto/trace/v1/trace_config.proto", fileDescriptorTraceConfig) -} - -var fileDescriptorTraceConfig = []byte{ - // 535 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdf, 0x6e, 0xd3, 0x30, - 0x14, 0xc6, 0xe7, 0x95, 0xfd, 0x3b, 0xd3, 0xb6, 0xe0, 0x6a, 0x28, 0x42, 0x53, 0x19, 0xb9, 0xa1, - 0x37, 0x6d, 0xd6, 0x71, 0x81, 0xc4, 0x05, 0x52, 0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0x83, 0x79, 0xd9, 0x6b, 0x3a, 0x57, 0xdd, 0xbe, 0xb1, 0x69, - 0xb5, 0x01, 0xaf, 0x0e, 0x26, 0x3e, 0x83, 0xb2, 0xbe, 0x16, 0xe3, 0x7e, 0x46, 0xd5, 0x57, 0x40, - 0xce, 0x3a, 0xc9, 0x7a, 0x05, 0xe5, 0x35, 0x93, 0x87, 0x0d, 0x28, 0x7d, 0x8d, 0x62, 0x6d, 0x2c, - 0x39, 0xc9, 0xb2, 0xf5, 0x03, 0xfd, 0x9a, 0x56, 0xd0, 0xef, 0x69, 0x05, 0xfd, 0x99, 0x56, 0xd0, - 0xf7, 0xbf, 0x95, 0x0d, 0x78, 0xc1, 0x44, 0xe1, 0xaf, 0xd2, 0x32, 0x32, 0xdf, 0x77, 0x2f, 0x91, - 0x7a, 0x68, 0xf0, 0xd1, 0x5f, 0x36, 0x31, 0x61, 0x7b, 0x22, 0x08, 0xa8, 0xa7, 0x84, 0xb4, 0x19, - 0x57, 0x54, 0x72, 0x12, 0xd8, 0x23, 0xa2, 0x48, 0xfe, 0xc5, 0xa9, 0x69, 0x7a, 0xcd, 0xa7, 0x3c, - 0xb3, 0xff, 0xe1, 0xfd, 0x19, 0x6e, 0x6b, 0xf5, 0xf5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, - 0x2e, 0x57, 0x2d, 0xa6, 0x04, 0x00, 0x00, -} diff --git a/internal/data/opentelemetry-proto-gen/collector/trace/v1/trace_service.pb.go b/internal/data/opentelemetry-proto-gen/collector/trace/v1/trace_service.pb.go index 48c0f97c9fe4..91a2bf793455 100644 --- a/internal/data/opentelemetry-proto-gen/collector/trace/v1/trace_service.pb.go +++ b/internal/data/opentelemetry-proto-gen/collector/trace/v1/trace_service.pb.go @@ -1,30 +1,21 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: opentelemetry/proto/collector/trace/v1/trace_service.proto -/* - Package v1 is a generated protocol buffer package. - - It is generated from these files: - opentelemetry/proto/collector/trace/v1/trace_service.proto - - It has these top-level messages: - ExportTraceServiceRequest - ExportTraceServiceResponse -*/ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import opentelemetry_proto_trace_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/trace/v1" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/trace/v1" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) -import io "io" - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf @@ -34,7 +25,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ExportTraceServiceRequest struct { // An array of ResourceSpans. @@ -42,17 +33,43 @@ type ExportTraceServiceRequest struct { // element. Intermediary nodes (such as OpenTelemetry Collector) that receive // data from multiple origins typically batch the data before forwarding further and // in that case this array will contain multiple elements. - ResourceSpans []*opentelemetry_proto_trace_v1.ResourceSpans `protobuf:"bytes,1,rep,name=resource_spans,json=resourceSpans" json:"resource_spans,omitempty"` + ResourceSpans []*v1.ResourceSpans `protobuf:"bytes,1,rep,name=resource_spans,json=resourceSpans,proto3" json:"resource_spans,omitempty"` } func (m *ExportTraceServiceRequest) Reset() { *m = ExportTraceServiceRequest{} } func (m *ExportTraceServiceRequest) String() string { return proto.CompactTextString(m) } func (*ExportTraceServiceRequest) ProtoMessage() {} func (*ExportTraceServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptorTraceService, []int{0} + return fileDescriptor_192a962890318cf4, []int{0} +} +func (m *ExportTraceServiceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExportTraceServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExportTraceServiceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExportTraceServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportTraceServiceRequest.Merge(m, src) +} +func (m *ExportTraceServiceRequest) XXX_Size() int { + return m.Size() +} +func (m *ExportTraceServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExportTraceServiceRequest.DiscardUnknown(m) } -func (m *ExportTraceServiceRequest) GetResourceSpans() []*opentelemetry_proto_trace_v1.ResourceSpans { +var xxx_messageInfo_ExportTraceServiceRequest proto.InternalMessageInfo + +func (m *ExportTraceServiceRequest) GetResourceSpans() []*v1.ResourceSpans { if m != nil { return m.ResourceSpans } @@ -66,14 +83,67 @@ func (m *ExportTraceServiceResponse) Reset() { *m = ExportTraceServiceRe func (m *ExportTraceServiceResponse) String() string { return proto.CompactTextString(m) } func (*ExportTraceServiceResponse) ProtoMessage() {} func (*ExportTraceServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptorTraceService, []int{1} + return fileDescriptor_192a962890318cf4, []int{1} +} +func (m *ExportTraceServiceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } +func (m *ExportTraceServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExportTraceServiceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExportTraceServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportTraceServiceResponse.Merge(m, src) +} +func (m *ExportTraceServiceResponse) XXX_Size() int { + return m.Size() +} +func (m *ExportTraceServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExportTraceServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportTraceServiceResponse proto.InternalMessageInfo func init() { proto.RegisterType((*ExportTraceServiceRequest)(nil), "opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest") proto.RegisterType((*ExportTraceServiceResponse)(nil), "opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse") } +func init() { + proto.RegisterFile("opentelemetry/proto/collector/trace/v1/trace_service.proto", fileDescriptor_192a962890318cf4) +} + +var fileDescriptor_192a962890318cf4 = []byte{ + // 294 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xca, 0x2f, 0x48, 0xcd, + 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, + 0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x2f, 0x29, 0x4a, 0x4c, 0x4e, 0xd5, + 0x2f, 0x33, 0x84, 0x30, 0xe2, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0xc0, 0xca, 0x84, + 0xd4, 0x50, 0xf4, 0x42, 0x04, 0xf5, 0xe0, 0x7a, 0xf5, 0xc0, 0x5a, 0xf4, 0xca, 0x0c, 0xa5, 0x34, + 0xb0, 0xd9, 0x81, 0x6a, 0x32, 0x44, 0xb3, 0x52, 0x3e, 0x97, 0xa4, 0x6b, 0x45, 0x41, 0x7e, 0x51, + 0x49, 0x08, 0x48, 0x30, 0x18, 0x62, 0x5b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x10, + 0x17, 0x5f, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x11, 0xc8, 0x21, 0x05, 0x89, 0x79, 0xc5, 0x12, 0x8c, + 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xda, 0x7a, 0xd8, 0xdc, 0x01, 0xb3, 0x5d, 0x2f, 0x08, 0xaa, 0x27, + 0x18, 0xa4, 0x25, 0x88, 0xb7, 0x08, 0x99, 0xab, 0x24, 0xc3, 0x25, 0x85, 0xcd, 0xc2, 0xe2, 0x82, + 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x45, 0x8c, 0x5c, 0x3c, 0xc8, 0x12, 0x42, 0x13, 0x19, 0xb9, 0xd8, + 0x20, 0xea, 0x85, 0x1c, 0xf5, 0x88, 0xf3, 0xbd, 0x1e, 0x4e, 0x0f, 0x49, 0x39, 0x51, 0x62, 0x04, + 0xc4, 0x89, 0x4a, 0x0c, 0x4e, 0x1b, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, + 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, + 0x81, 0x4b, 0x33, 0x33, 0x9f, 0x48, 0x2b, 0x9c, 0x04, 0x91, 0x4d, 0x0f, 0x00, 0xa9, 0x0a, 0x60, + 0x8c, 0x0a, 0x4b, 0x47, 0xd7, 0x9f, 0x89, 0x9c, 0x38, 0x32, 0xf3, 0x4a, 0x52, 0x8b, 0xf2, 0x12, + 0x73, 0xf4, 0x53, 0x12, 0x4b, 0x12, 0xf5, 0x51, 0x14, 0xea, 0x82, 0x2d, 0xd2, 0x4d, 0x4f, 0xcd, + 0xc3, 0x92, 0x98, 0x92, 0xd8, 0xc0, 0xb2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9e, 0xb1, + 0x47, 0x6d, 0x7d, 0x02, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -82,8 +152,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for TraceService service - +// TraceServiceClient is the client API for TraceService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type TraceServiceClient interface { // For performance reasons, it is recommended to keep this RPC // alive for the entire life of the application. @@ -100,21 +171,28 @@ func NewTraceServiceClient(cc *grpc.ClientConn) TraceServiceClient { func (c *traceServiceClient) Export(ctx context.Context, in *ExportTraceServiceRequest, opts ...grpc.CallOption) (*ExportTraceServiceResponse, error) { out := new(ExportTraceServiceResponse) - err := grpc.Invoke(ctx, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for TraceService service - +// TraceServiceServer is the server API for TraceService service. type TraceServiceServer interface { // For performance reasons, it is recommended to keep this RPC // alive for the entire life of the application. Export(context.Context, *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error) } +// UnimplementedTraceServiceServer can be embedded to have forward compatible implementations. +type UnimplementedTraceServiceServer struct { +} + +func (*UnimplementedTraceServiceServer) Export(ctx context.Context, req *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Export not implemented") +} + func RegisterTraceServiceServer(s *grpc.Server, srv TraceServiceServer) { s.RegisterService(&_TraceService_serviceDesc, srv) } @@ -153,7 +231,7 @@ var _TraceService_serviceDesc = grpc.ServiceDesc{ func (m *ExportTraceServiceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -161,29 +239,36 @@ func (m *ExportTraceServiceRequest) Marshal() (dAtA []byte, err error) { } func (m *ExportTraceServiceRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExportTraceServiceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.ResourceSpans) > 0 { - for _, msg := range m.ResourceSpans { - dAtA[i] = 0xa - i++ - i = encodeVarintTraceService(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.ResourceSpans) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceSpans[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTraceService(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *ExportTraceServiceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -191,41 +276,33 @@ func (m *ExportTraceServiceResponse) Marshal() (dAtA []byte, err error) { } func (m *ExportTraceServiceResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExportTraceServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } -func encodeFixed64TraceService(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32TraceService(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintTraceService(dAtA []byte, offset int, v uint64) int { + offset -= sovTraceService(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ExportTraceServiceRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.ResourceSpans) > 0 { @@ -238,20 +315,16 @@ func (m *ExportTraceServiceRequest) Size() (n int) { } func (m *ExportTraceServiceResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l return n } func sovTraceService(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTraceService(x uint64) (n int) { return sovTraceService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -271,7 +344,7 @@ func (m *ExportTraceServiceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -299,7 +372,7 @@ func (m *ExportTraceServiceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -308,10 +381,13 @@ func (m *ExportTraceServiceRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTraceService } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTraceService + } if postIndex > l { return io.ErrUnexpectedEOF } - m.ResourceSpans = append(m.ResourceSpans, &opentelemetry_proto_trace_v1.ResourceSpans{}) + m.ResourceSpans = append(m.ResourceSpans, &v1.ResourceSpans{}) if err := m.ResourceSpans[len(m.ResourceSpans)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -325,6 +401,9 @@ func (m *ExportTraceServiceRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTraceService } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTraceService + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -352,7 +431,7 @@ func (m *ExportTraceServiceResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -375,6 +454,9 @@ func (m *ExportTraceServiceResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTraceService } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTraceService + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -390,6 +472,7 @@ func (m *ExportTraceServiceResponse) Unmarshal(dAtA []byte) error { func skipTraceService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -421,10 +504,8 @@ func skipTraceService(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -441,79 +522,34 @@ func skipTraceService(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthTraceService } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTraceService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTraceService(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTraceService + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTraceService + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTraceService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTraceService = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTraceService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTraceService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTraceService = fmt.Errorf("proto: unexpected end of group") ) - -func init() { - proto.RegisterFile("opentelemetry/proto/collector/trace/v1/trace_service.proto", fileDescriptorTraceService) -} - -var fileDescriptorTraceService = []byte{ - // 285 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xca, 0x2f, 0x48, 0xcd, - 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, - 0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x2f, 0x29, 0x4a, 0x4c, 0x4e, 0xd5, - 0x2f, 0x33, 0x84, 0x30, 0xe2, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0xc0, 0xca, 0x84, - 0xd4, 0x50, 0xf4, 0x42, 0x04, 0xf5, 0xe0, 0x7a, 0xf5, 0xc0, 0x5a, 0xf4, 0xca, 0x0c, 0xa5, 0x34, - 0xb0, 0xd9, 0x81, 0x6a, 0x32, 0x44, 0xb3, 0x52, 0x3e, 0x97, 0xa4, 0x6b, 0x45, 0x41, 0x7e, 0x51, - 0x49, 0x08, 0x48, 0x30, 0x18, 0x62, 0x5b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x10, - 0x17, 0x5f, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x11, 0xc8, 0x21, 0x05, 0x89, 0x79, 0xc5, 0x12, 0x8c, - 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xda, 0x7a, 0xd8, 0xdc, 0x01, 0xb3, 0x5d, 0x2f, 0x08, 0xaa, 0x27, - 0x18, 0xa4, 0x25, 0x88, 0xb7, 0x08, 0x99, 0xab, 0x24, 0xc3, 0x25, 0x85, 0xcd, 0xc2, 0xe2, 0x82, - 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x45, 0x8c, 0x5c, 0x3c, 0xc8, 0x12, 0x42, 0x13, 0x19, 0xb9, 0xd8, - 0x20, 0xea, 0x85, 0x1c, 0xf5, 0x88, 0xf3, 0xbd, 0x1e, 0x4e, 0x0f, 0x49, 0x39, 0x51, 0x62, 0x04, - 0xc4, 0x89, 0x4a, 0x0c, 0x4e, 0x2b, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, - 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0xb8, 0x34, 0x33, 0xf3, 0x89, 0x34, 0xda, 0x49, - 0x10, 0xd9, 0xd4, 0x00, 0x90, 0xaa, 0x00, 0xc6, 0xa8, 0xb0, 0x74, 0x74, 0xfd, 0x99, 0xc8, 0x89, - 0x22, 0x33, 0xaf, 0x24, 0xb5, 0x28, 0x2f, 0x31, 0x47, 0x3f, 0x25, 0xb1, 0x24, 0x51, 0x1f, 0x45, - 0xa1, 0x2e, 0xd8, 0x22, 0xdd, 0xf4, 0xd4, 0x3c, 0x2c, 0x89, 0x28, 0x89, 0x0d, 0x2c, 0x6b, 0x0c, - 0x08, 0x00, 0x00, 0xff, 0xff, 0x00, 0x95, 0xd3, 0x78, 0x75, 0x02, 0x00, 0x00, -} diff --git a/internal/data/opentelemetry-proto-gen/common/v1/common.pb.go b/internal/data/opentelemetry-proto-gen/common/v1/common.pb.go index 1d8e83d58bc3..562ffce2adbc 100644 --- a/internal/data/opentelemetry-proto-gen/common/v1/common.pb.go +++ b/internal/data/opentelemetry-proto-gen/common/v1/common.pb.go @@ -1,24 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: opentelemetry/proto/common/v1/common.proto -/* - Package v1 is a generated protocol buffer package. - - It is generated from these files: - opentelemetry/proto/common/v1/common.proto - - It has these top-level messages: - AttributeKeyValue - StringKeyValue - InstrumentationLibrary -*/ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" +import ( + encoding_binary "encoding/binary" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -29,109 +21,342 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// ValueType is the enumeration of possible types that value can have. -type AttributeKeyValue_ValueType int32 - -const ( - AttributeKeyValue_STRING AttributeKeyValue_ValueType = 0 - AttributeKeyValue_INT AttributeKeyValue_ValueType = 1 - AttributeKeyValue_DOUBLE AttributeKeyValue_ValueType = 2 - AttributeKeyValue_BOOL AttributeKeyValue_ValueType = 3 -) +// 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 primitives. +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_StringValue + // *AnyValue_BoolValue + // *AnyValue_IntValue + // *AnyValue_DoubleValue + // *AnyValue_ArrayValue + // *AnyValue_KvlistValue + Value isAnyValue_Value `protobuf_oneof:"value"` +} -var AttributeKeyValue_ValueType_name = map[int32]string{ - 0: "STRING", - 1: "INT", - 2: "DOUBLE", - 3: "BOOL", +func (m *AnyValue) Reset() { *m = AnyValue{} } +func (m *AnyValue) String() string { return proto.CompactTextString(m) } +func (*AnyValue) ProtoMessage() {} +func (*AnyValue) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{0} +} +func (m *AnyValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AnyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AnyValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AnyValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_AnyValue.Merge(m, src) +} +func (m *AnyValue) XXX_Size() int { + return m.Size() +} +func (m *AnyValue) XXX_DiscardUnknown() { + xxx_messageInfo_AnyValue.DiscardUnknown(m) } -var AttributeKeyValue_ValueType_value = map[string]int32{ - "STRING": 0, - "INT": 1, - "DOUBLE": 2, - "BOOL": 3, + +var xxx_messageInfo_AnyValue proto.InternalMessageInfo + +type isAnyValue_Value interface { + isAnyValue_Value() + MarshalTo([]byte) (int, error) + Size() int } -func (x AttributeKeyValue_ValueType) String() string { - return proto.EnumName(AttributeKeyValue_ValueType_name, int32(x)) +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_IntValue struct { + IntValue int64 `protobuf:"varint,3,opt,name=int_value,json=intValue,proto3,oneof" json:"int_value,omitempty"` } -func (AttributeKeyValue_ValueType) EnumDescriptor() ([]byte, []int) { - return fileDescriptorCommon, []int{0, 0} +type AnyValue_DoubleValue struct { + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3,oneof" json:"double_value,omitempty"` +} +type AnyValue_ArrayValue struct { + ArrayValue *ArrayValue `protobuf:"bytes,5,opt,name=array_value,json=arrayValue,proto3,oneof" json:"array_value,omitempty"` +} +type AnyValue_KvlistValue struct { + KvlistValue *KeyValueList `protobuf:"bytes,6,opt,name=kvlist_value,json=kvlistValue,proto3,oneof" json:"kvlist_value,omitempty"` } -// AttributeKeyValue is a key-value pair that is used to store Span attributes, Link -// attributes, etc. -type AttributeKeyValue struct { - // key part of the key-value pair. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // type of the value. - Type AttributeKeyValue_ValueType `protobuf:"varint,2,opt,name=type,proto3,enum=opentelemetry.proto.common.v1.AttributeKeyValue_ValueType" json:"type,omitempty"` - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` - IntValue int64 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3" json:"int_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,5,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` - BoolValue bool `protobuf:"varint,6,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` -} - -func (m *AttributeKeyValue) Reset() { *m = AttributeKeyValue{} } -func (m *AttributeKeyValue) String() string { return proto.CompactTextString(m) } -func (*AttributeKeyValue) ProtoMessage() {} -func (*AttributeKeyValue) Descriptor() ([]byte, []int) { return fileDescriptorCommon, []int{0} } - -func (m *AttributeKeyValue) GetKey() string { +func (*AnyValue_StringValue) isAnyValue_Value() {} +func (*AnyValue_BoolValue) isAnyValue_Value() {} +func (*AnyValue_IntValue) isAnyValue_Value() {} +func (*AnyValue_DoubleValue) isAnyValue_Value() {} +func (*AnyValue_ArrayValue) isAnyValue_Value() {} +func (*AnyValue_KvlistValue) isAnyValue_Value() {} + +func (m *AnyValue) GetValue() isAnyValue_Value { if m != nil { - return m.Key + return m.Value + } + return nil +} + +func (m *AnyValue) GetStringValue() string { + if x, ok := m.GetValue().(*AnyValue_StringValue); ok { + return x.StringValue } return "" } -func (m *AttributeKeyValue) GetType() AttributeKeyValue_ValueType { - if m != nil { - return m.Type +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 + } + return 0 +} + +func (m *AnyValue) GetDoubleValue() float64 { + if x, ok := m.GetValue().(*AnyValue_DoubleValue); ok { + return x.DoubleValue + } + return 0 +} + +func (m *AnyValue) GetArrayValue() *ArrayValue { + if x, ok := m.GetValue().(*AnyValue_ArrayValue); ok { + return x.ArrayValue + } + return nil +} + +func (m *AnyValue) GetKvlistValue() *KeyValueList { + if x, ok := m.GetValue().(*AnyValue_KvlistValue); ok { + return x.KvlistValue + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*AnyValue) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*AnyValue_StringValue)(nil), + (*AnyValue_BoolValue)(nil), + (*AnyValue_IntValue)(nil), + (*AnyValue_DoubleValue)(nil), + (*AnyValue_ArrayValue)(nil), + (*AnyValue_KvlistValue)(nil), + } +} + +// ArrayValue is a list of AnyValue messages. We need ArrayValue as a message +// since oneof in AnyValue does not allow repeated fields. +type ArrayValue struct { + // Array of values. The array may be empty (contain 0 elements). + Values []*AnyValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` +} + +func (m *ArrayValue) Reset() { *m = ArrayValue{} } +func (m *ArrayValue) String() string { return proto.CompactTextString(m) } +func (*ArrayValue) ProtoMessage() {} +func (*ArrayValue) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{1} +} +func (m *ArrayValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ArrayValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ArrayValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return AttributeKeyValue_STRING +} +func (m *ArrayValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_ArrayValue.Merge(m, src) +} +func (m *ArrayValue) XXX_Size() int { + return m.Size() +} +func (m *ArrayValue) XXX_DiscardUnknown() { + xxx_messageInfo_ArrayValue.DiscardUnknown(m) } -func (m *AttributeKeyValue) GetStringValue() string { +var xxx_messageInfo_ArrayValue proto.InternalMessageInfo + +func (m *ArrayValue) GetValues() []*AnyValue { if m != nil { - return m.StringValue + return m.Values } - return "" + return nil +} + +// KeyValueList is a list of KeyValue messages. We need KeyValueList as a message +// since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need +// a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to +// avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches +// are semantically equivalent. +type KeyValueList struct { + // A collection of key/value pairs of key-value pairs. The list may be empty (may + // contain 0 elements). + Values []*KeyValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` +} + +func (m *KeyValueList) Reset() { *m = KeyValueList{} } +func (m *KeyValueList) String() string { return proto.CompactTextString(m) } +func (*KeyValueList) ProtoMessage() {} +func (*KeyValueList) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{2} +} +func (m *KeyValueList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *KeyValueList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_KeyValueList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *KeyValueList) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeyValueList.Merge(m, src) +} +func (m *KeyValueList) XXX_Size() int { + return m.Size() +} +func (m *KeyValueList) XXX_DiscardUnknown() { + xxx_messageInfo_KeyValueList.DiscardUnknown(m) } -func (m *AttributeKeyValue) GetIntValue() int64 { +var xxx_messageInfo_KeyValueList proto.InternalMessageInfo + +func (m *KeyValueList) GetValues() []*KeyValue { if m != nil { - return m.IntValue + return m.Values } - return 0 + return nil +} + +// KeyValue is a key-value pair that is used to store Span attributes, Link +// attributes, etc. +type KeyValue struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *AnyValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *KeyValue) Reset() { *m = KeyValue{} } +func (m *KeyValue) String() string { return proto.CompactTextString(m) } +func (*KeyValue) ProtoMessage() {} +func (*KeyValue) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{3} +} +func (m *KeyValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *KeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_KeyValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *KeyValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeyValue.Merge(m, src) +} +func (m *KeyValue) XXX_Size() int { + return m.Size() } +func (m *KeyValue) XXX_DiscardUnknown() { + xxx_messageInfo_KeyValue.DiscardUnknown(m) +} + +var xxx_messageInfo_KeyValue proto.InternalMessageInfo -func (m *AttributeKeyValue) GetDoubleValue() float64 { +func (m *KeyValue) GetKey() string { if m != nil { - return m.DoubleValue + return m.Key } - return 0 + return "" } -func (m *AttributeKeyValue) GetBoolValue() bool { +func (m *KeyValue) GetValue() *AnyValue { if m != nil { - return m.BoolValue + return m.Value } - return false + return nil } // StringKeyValue is a pair of key/value strings. This is the simpler (and faster) version -// of AttributeKeyValue that only supports string values. +// of KeyValue that only supports string values. type StringKeyValue struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (m *StringKeyValue) Reset() { *m = StringKeyValue{} } -func (m *StringKeyValue) String() string { return proto.CompactTextString(m) } -func (*StringKeyValue) ProtoMessage() {} -func (*StringKeyValue) Descriptor() ([]byte, []int) { return fileDescriptorCommon, []int{1} } +func (m *StringKeyValue) Reset() { *m = StringKeyValue{} } +func (m *StringKeyValue) String() string { return proto.CompactTextString(m) } +func (*StringKeyValue) ProtoMessage() {} +func (*StringKeyValue) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{4} +} +func (m *StringKeyValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StringKeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StringKeyValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StringKeyValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringKeyValue.Merge(m, src) +} +func (m *StringKeyValue) XXX_Size() int { + return m.Size() +} +func (m *StringKeyValue) XXX_DiscardUnknown() { + xxx_messageInfo_StringKeyValue.DiscardUnknown(m) +} + +var xxx_messageInfo_StringKeyValue proto.InternalMessageInfo func (m *StringKeyValue) GetKey() string { if m != nil { @@ -154,10 +379,38 @@ type InstrumentationLibrary struct { Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` } -func (m *InstrumentationLibrary) Reset() { *m = InstrumentationLibrary{} } -func (m *InstrumentationLibrary) String() string { return proto.CompactTextString(m) } -func (*InstrumentationLibrary) ProtoMessage() {} -func (*InstrumentationLibrary) Descriptor() ([]byte, []int) { return fileDescriptorCommon, []int{2} } +func (m *InstrumentationLibrary) Reset() { *m = InstrumentationLibrary{} } +func (m *InstrumentationLibrary) String() string { return proto.CompactTextString(m) } +func (*InstrumentationLibrary) ProtoMessage() {} +func (*InstrumentationLibrary) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{5} +} +func (m *InstrumentationLibrary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *InstrumentationLibrary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InstrumentationLibrary.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *InstrumentationLibrary) XXX_Merge(src proto.Message) { + xxx_messageInfo_InstrumentationLibrary.Merge(m, src) +} +func (m *InstrumentationLibrary) XXX_Size() int { + return m.Size() +} +func (m *InstrumentationLibrary) XXX_DiscardUnknown() { + xxx_messageInfo_InstrumentationLibrary.DiscardUnknown(m) +} + +var xxx_messageInfo_InstrumentationLibrary proto.InternalMessageInfo func (m *InstrumentationLibrary) GetName() string { if m != nil { @@ -174,100 +427,338 @@ func (m *InstrumentationLibrary) GetVersion() string { } func init() { - proto.RegisterType((*AttributeKeyValue)(nil), "opentelemetry.proto.common.v1.AttributeKeyValue") + proto.RegisterType((*AnyValue)(nil), "opentelemetry.proto.common.v1.AnyValue") + proto.RegisterType((*ArrayValue)(nil), "opentelemetry.proto.common.v1.ArrayValue") + proto.RegisterType((*KeyValueList)(nil), "opentelemetry.proto.common.v1.KeyValueList") + proto.RegisterType((*KeyValue)(nil), "opentelemetry.proto.common.v1.KeyValue") proto.RegisterType((*StringKeyValue)(nil), "opentelemetry.proto.common.v1.StringKeyValue") proto.RegisterType((*InstrumentationLibrary)(nil), "opentelemetry.proto.common.v1.InstrumentationLibrary") - proto.RegisterEnum("opentelemetry.proto.common.v1.AttributeKeyValue_ValueType", AttributeKeyValue_ValueType_name, AttributeKeyValue_ValueType_value) } -func (m *AttributeKeyValue) Marshal() (dAtA []byte, err error) { + +func init() { + proto.RegisterFile("opentelemetry/proto/common/v1/common.proto", fileDescriptor_62ba46dcb97aa817) +} + +var fileDescriptor_62ba46dcb97aa817 = []byte{ + // 453 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x6f, 0xd3, 0x30, + 0x14, 0x8f, 0xd7, 0xad, 0x6b, 0x5f, 0x2a, 0x84, 0x2c, 0x84, 0x7a, 0x59, 0x88, 0xca, 0x81, 0x00, + 0x5a, 0xa2, 0x8d, 0x0b, 0x17, 0x84, 0x56, 0x24, 0x14, 0x44, 0x27, 0xaa, 0x20, 0x71, 0x80, 0x03, + 0x72, 0x36, 0xab, 0xb2, 0xe6, 0xd8, 0x93, 0xe3, 0x46, 0xca, 0xb7, 0xe0, 0xc8, 0x97, 0xe1, 0xce, + 0x71, 0x47, 0x8e, 0xa8, 0xfd, 0x22, 0xc8, 0x7f, 0xd2, 0x6d, 0x1c, 0x3a, 0xed, 0xf6, 0xde, 0x2f, + 0xbf, 0x3f, 0xef, 0xc5, 0x36, 0xbc, 0x90, 0x97, 0x54, 0x68, 0xca, 0x69, 0x45, 0xb5, 0x6a, 0xb3, + 0x4b, 0x25, 0xb5, 0xcc, 0xce, 0x64, 0x55, 0x49, 0x91, 0x35, 0x47, 0xbe, 0x4a, 0x2d, 0x8c, 0x0f, + 0x6e, 0x71, 0x1d, 0x98, 0x7a, 0x46, 0x73, 0x34, 0xf9, 0xb5, 0x03, 0x83, 0x13, 0xd1, 0x7e, 0x21, + 0x7c, 0x49, 0xf1, 0x53, 0x18, 0xd5, 0x5a, 0x31, 0xb1, 0xf8, 0xde, 0x98, 0x7e, 0x8c, 0x62, 0x94, + 0x0c, 0xf3, 0xa0, 0x08, 0x1d, 0xea, 0x48, 0x4f, 0x00, 0x4a, 0x29, 0xb9, 0xa7, 0xec, 0xc4, 0x28, + 0x19, 0xe4, 0x41, 0x31, 0x34, 0x98, 0x23, 0x1c, 0xc0, 0x90, 0x09, 0xed, 0xbf,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x6b, 0x3c, 0x86, 0xfd, 0x86, 0xaa, 0x9a, 0x49, 0xe1, 0x5d, 0xba, 0x76, 0xfa, 0x13, + 0xfd, 0x5e, 0x45, 0xe8, 0x6a, 0x15, 0xa1, 0xbf, 0xab, 0x08, 0xfd, 0x58, 0x47, 0xc1, 0xd5, 0x3a, + 0x0a, 0xfe, 0xac, 0xa3, 0x00, 0x62, 0x26, 0xb7, 0xaf, 0x33, 0x0d, 0xdf, 0xd9, 0x72, 0x6e, 0xe0, + 0x39, 0xfa, 0x7a, 0xba, 0xf8, 0x5f, 0xc0, 0xcc, 0xab, 0xe2, 0x9c, 0x9e, 0x69, 0xa9, 0x32, 0x26, + 0x34, 0x55, 0x82, 0xf0, 0xec, 0x9c, 0x68, 0x92, 0xdd, 0x22, 0x1e, 0x5a, 0xe7, 0xc3, 0x05, 0x15, + 0xd7, 0xaf, 0xb0, 0xec, 0x5b, 0xf0, 0xd5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x61, 0x6c, 0x89, + 0x81, 0xad, 0x03, 0x00, 0x00, +} + +func (m *AnyValue) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } -func (m *AttributeKeyValue) MarshalTo(dAtA []byte) (int, error) { - var i int +func (m *AnyValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AnyValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCommon(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.Value != nil { + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } } - if m.Type != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintCommon(dAtA, i, uint64(m.Type)) + 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]) +} + +func (m *AnyValue_BoolValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i-- + if m.BoolValue { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } - if len(m.StringValue) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintCommon(dAtA, i, uint64(len(m.StringValue))) - i += copy(dAtA[i:], m.StringValue) + i-- + dAtA[i] = 0x10 + return len(dAtA) - i, nil +} +func (m *AnyValue_IntValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AnyValue_IntValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i = encodeVarintCommon(dAtA, i, uint64(m.IntValue)) + i-- + dAtA[i] = 0x18 + return len(dAtA) - i, nil +} +func (m *AnyValue_DoubleValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AnyValue_DoubleValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.DoubleValue)))) + i-- + dAtA[i] = 0x21 + return len(dAtA) - i, nil +} +func (m *AnyValue_ArrayValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AnyValue_ArrayValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ArrayValue != nil { + { + size, err := m.ArrayValue.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - if m.IntValue != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintCommon(dAtA, i, uint64(m.IntValue)) + return len(dAtA) - i, nil +} +func (m *AnyValue_KvlistValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AnyValue_KvlistValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.KvlistValue != nil { + { + size, err := m.KvlistValue.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 } - if m.DoubleValue != 0 { - dAtA[i] = 0x29 - i++ - i = encodeFixed64Common(dAtA, i, uint64(math.Float64bits(float64(m.DoubleValue)))) + return len(dAtA) - i, nil +} +func (m *ArrayValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - if m.BoolValue { - dAtA[i] = 0x30 - i++ - if m.BoolValue { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + return dAtA[:n], nil +} + +func (m *ArrayValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ArrayValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Values) > 0 { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Values[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - i++ } - return i, nil + return len(dAtA) - i, nil } -func (m *StringKeyValue) Marshal() (dAtA []byte, err error) { +func (m *KeyValueList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } -func (m *StringKeyValue) MarshalTo(dAtA []byte) (int, error) { - var i int +func (m *KeyValueList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyValueList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if len(m.Values) > 0 { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Values[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *KeyValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *KeyValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != nil { + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Key) + copy(dAtA[i:], m.Key) i = encodeVarintCommon(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + i-- + dAtA[i] = 0xa } + return len(dAtA) - i, nil +} + +func (m *StringKeyValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StringKeyValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StringKeyValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintCommon(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintCommon(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *InstrumentationLibrary) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -275,79 +766,167 @@ func (m *InstrumentationLibrary) Marshal() (dAtA []byte, err error) { } func (m *InstrumentationLibrary) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InstrumentationLibrary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCommon(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } if len(m.Version) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Version) + copy(dAtA[i:], m.Version) i = encodeVarintCommon(dAtA, i, uint64(len(m.Version))) - i += copy(dAtA[i:], m.Version) + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCommon(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func encodeFixed64Common(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Common(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintCommon(dAtA []byte, offset int, v uint64) int { + offset -= sovCommon(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } -func (m *AttributeKeyValue) Size() (n int) { +func (m *AnyValue) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovCommon(uint64(l)) + if m.Value != nil { + n += m.Value.Size() } - if m.Type != 0 { - n += 1 + sovCommon(uint64(m.Type)) + return n +} + +func (m *AnyValue_StringValue) Size() (n int) { + if m == nil { + return 0 } + var l int + _ = l l = len(m.StringValue) - if l > 0 { + n += 1 + l + sovCommon(uint64(l)) + return n +} +func (m *AnyValue_BoolValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 2 + return n +} +func (m *AnyValue_IntValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovCommon(uint64(m.IntValue)) + return n +} +func (m *AnyValue_DoubleValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 9 + return n +} +func (m *AnyValue_ArrayValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ArrayValue != nil { + l = m.ArrayValue.Size() n += 1 + l + sovCommon(uint64(l)) } - if m.IntValue != 0 { - n += 1 + sovCommon(uint64(m.IntValue)) + return n +} +func (m *AnyValue_KvlistValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.KvlistValue != nil { + l = m.KvlistValue.Size() + n += 1 + l + sovCommon(uint64(l)) } - if m.DoubleValue != 0 { - n += 9 + return n +} +func (m *ArrayValue) Size() (n int) { + if m == nil { + return 0 } - if m.BoolValue { - n += 2 + var l int + _ = l + if len(m.Values) > 0 { + for _, e := range m.Values { + l = e.Size() + n += 1 + l + sovCommon(uint64(l)) + } + } + return n +} + +func (m *KeyValueList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Values) > 0 { + for _, e := range m.Values { + l = e.Size() + n += 1 + l + sovCommon(uint64(l)) + } + } + return n +} + +func (m *KeyValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovCommon(uint64(l)) + } + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovCommon(uint64(l)) } return n } func (m *StringKeyValue) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Key) @@ -362,6 +941,9 @@ func (m *StringKeyValue) Size() (n int) { } func (m *InstrumentationLibrary) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -372,23 +954,223 @@ func (m *InstrumentationLibrary) Size() (n int) { if l > 0 { n += 1 + l + sovCommon(uint64(l)) } - return n -} + return n +} + +func sovCommon(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCommon(x uint64) (n int) { + return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AnyValue) Unmarshal(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 ErrIntOverflowCommon + } + 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: AnyValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AnyValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCommon + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = &AnyValue_StringValue{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + 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) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Value = &AnyValue_IntValue{v} + case 4: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field DoubleValue", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Value = &AnyValue_DoubleValue{float64(math.Float64frombits(v))} + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ArrayValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ArrayValue{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &AnyValue_ArrayValue{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KvlistValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &KeyValueList{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &AnyValue_KvlistValue{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func sovCommon(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n -} -func sozCommon(x uint64) (n int) { - return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { +func (m *ArrayValue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -403,7 +1185,7 @@ func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -411,17 +1193,17 @@ func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AttributeKeyValue: wiretype end group for non-group") + return fmt.Errorf("proto: ArrayValue: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AttributeKeyValue: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ArrayValue: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCommon @@ -431,26 +1213,84 @@ func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { + return ErrInvalidLengthCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { return ErrInvalidLengthCommon } - postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) + m.Values = append(m.Values, &AnyValue{}) + if err := m.Values[len(m.Values)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + default: + iNdEx = preIndex + skippy, err := skipCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeyValueList) Unmarshal(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 ErrIntOverflowCommon + } + 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: KeyValueList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyValueList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } - m.Type = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCommon @@ -460,14 +1300,82 @@ func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (AttributeKeyValue_ValueType(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 3: + if msglen < 0 { + return ErrInvalidLengthCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Values = append(m.Values, &KeyValue{}) + if err := m.Values[len(m.Values)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeyValue) Unmarshal(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 ErrIntOverflowCommon + } + 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: KeyValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -479,7 +1387,7 @@ func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -489,16 +1397,19 @@ func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { return ErrInvalidLengthCommon } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } if postIndex > l { return io.ErrUnexpectedEOF } - m.StringValue = string(dAtA[iNdEx:postIndex]) + m.Key = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IntValue", wireType) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } - m.IntValue = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCommon @@ -508,49 +1419,28 @@ func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.IntValue |= (int64(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 5: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field DoubleValue", wireType) + if msglen < 0 { + return ErrInvalidLengthCommon } - var v uint64 - if (iNdEx + 8) > l { + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 - m.DoubleValue = float64(math.Float64frombits(v)) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) + if m.Value == nil { + m.Value = &AnyValue{} } - 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 - } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.BoolValue = bool(v != 0) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCommon(dAtA[iNdEx:]) @@ -560,6 +1450,9 @@ func (m *AttributeKeyValue) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthCommon } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCommon + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -587,7 +1480,7 @@ func (m *StringKeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -615,7 +1508,7 @@ func (m *StringKeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -625,6 +1518,9 @@ func (m *StringKeyValue) Unmarshal(dAtA []byte) error { return ErrInvalidLengthCommon } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -644,7 +1540,7 @@ func (m *StringKeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -654,6 +1550,9 @@ func (m *StringKeyValue) Unmarshal(dAtA []byte) error { return ErrInvalidLengthCommon } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -668,6 +1567,9 @@ func (m *StringKeyValue) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthCommon } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCommon + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -695,7 +1597,7 @@ func (m *InstrumentationLibrary) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -723,7 +1625,7 @@ func (m *InstrumentationLibrary) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -733,6 +1635,9 @@ func (m *InstrumentationLibrary) Unmarshal(dAtA []byte) error { return ErrInvalidLengthCommon } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -752,7 +1657,7 @@ func (m *InstrumentationLibrary) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -762,6 +1667,9 @@ func (m *InstrumentationLibrary) Unmarshal(dAtA []byte) error { return ErrInvalidLengthCommon } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -776,6 +1684,9 @@ func (m *InstrumentationLibrary) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthCommon } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCommon + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -791,6 +1702,7 @@ func (m *InstrumentationLibrary) Unmarshal(dAtA []byte) error { func skipCommon(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -822,10 +1734,8 @@ func skipCommon(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -842,85 +1752,34 @@ func skipCommon(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthCommon } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCommon - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipCommon(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCommon + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthCommon + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthCommon = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCommon = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthCommon = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCommon = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCommon = fmt.Errorf("proto: unexpected end of group") ) - -func init() { proto.RegisterFile("opentelemetry/proto/common/v1/common.proto", fileDescriptorCommon) } - -var fileDescriptorCommon = []byte{ - // 409 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xdf, 0x8a, 0xd3, 0x40, - 0x14, 0xc6, 0x77, 0x9a, 0x6e, 0xb7, 0x3d, 0x5d, 0x96, 0x38, 0x88, 0x14, 0x64, 0x43, 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, 0x06, 0x3e, 0xf9, 0x15, 0x00, 0x00, 0xff, - 0xff, 0xab, 0x29, 0xe9, 0xdf, 0x9a, 0x02, 0x00, 0x00, -} diff --git a/internal/data/opentelemetry-proto-gen/logs/v1/logs.pb.go b/internal/data/opentelemetry-proto-gen/logs/v1/logs.pb.go index b066fc6bdca3..3beadd7dcb93 100644 --- a/internal/data/opentelemetry-proto-gen/logs/v1/logs.pb.go +++ b/internal/data/opentelemetry-proto-gen/logs/v1/logs.pb.go @@ -1,33 +1,23 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: logs/v1/logs.proto -/* - Package v1 is a generated protocol buffer package. - - It is generated from these files: - logs/v1/logs.proto - - It has these top-level messages: - ExportLogServiceRequest - ExportLogServiceResponse - ResourceLogs - LogRecord -*/ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import opentelemetry_proto_common_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" -import opentelemetry_proto_resource_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1" - import ( - context "golang.org/x/net/context" + context "context" + encoding_binary "encoding/binary" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + v11 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" + v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) -import io "io" - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf @@ -37,7 +27,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type SeverityNumber int32 @@ -96,6 +86,7 @@ var SeverityNumber_name = map[int32]string{ 23: "FATAL3", 24: "FATAL4", } + var SeverityNumber_value = map[string]int32{ "UNDEFINED_SEVERITY_NUMBER": 0, "TRACE": 1, @@ -127,7 +118,10 @@ var SeverityNumber_value = map[string]int32{ func (x SeverityNumber) String() string { return proto.EnumName(SeverityNumber_name, int32(x)) } -func (SeverityNumber) EnumDescriptor() ([]byte, []int) { return fileDescriptorLogs, []int{0} } + +func (SeverityNumber) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5e9a98bab354281e, []int{0} +} type LogRecordFlags int32 @@ -140,6 +134,7 @@ var LogRecordFlags_name = map[int32]string{ 0: "UNDEFINED_LOG_RECORD_FLAG", 255: "TRACE_FLAGS_MASK", } + var LogRecordFlags_value = map[string]int32{ "UNDEFINED_LOG_RECORD_FLAG": 0, "TRACE_FLAGS_MASK": 255, @@ -148,7 +143,10 @@ var LogRecordFlags_value = map[string]int32{ func (x LogRecordFlags) String() string { return proto.EnumName(LogRecordFlags_name, int32(x)) } -func (LogRecordFlags) EnumDescriptor() ([]byte, []int) { return fileDescriptorLogs, []int{1} } + +func (LogRecordFlags) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5e9a98bab354281e, []int{1} +} type ExportLogServiceRequest struct { // An array of ResourceLogs. @@ -156,13 +154,41 @@ type ExportLogServiceRequest struct { // element. Intermediary nodes (such as OpenTelemetry Collector) that receive // data from multiple origins typically batch the data before forwarding further and // in that case this array will contain multiple elements. - ResourceLogs []*ResourceLogs `protobuf:"bytes,1,rep,name=resource_logs,json=resourceLogs" json:"resource_logs,omitempty"` + ResourceLogs []*ResourceLogs `protobuf:"bytes,1,rep,name=resource_logs,json=resourceLogs,proto3" json:"resource_logs,omitempty"` +} + +func (m *ExportLogServiceRequest) Reset() { *m = ExportLogServiceRequest{} } +func (m *ExportLogServiceRequest) String() string { return proto.CompactTextString(m) } +func (*ExportLogServiceRequest) ProtoMessage() {} +func (*ExportLogServiceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e9a98bab354281e, []int{0} +} +func (m *ExportLogServiceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExportLogServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExportLogServiceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExportLogServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportLogServiceRequest.Merge(m, src) +} +func (m *ExportLogServiceRequest) XXX_Size() int { + return m.Size() +} +func (m *ExportLogServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExportLogServiceRequest.DiscardUnknown(m) } -func (m *ExportLogServiceRequest) Reset() { *m = ExportLogServiceRequest{} } -func (m *ExportLogServiceRequest) String() string { return proto.CompactTextString(m) } -func (*ExportLogServiceRequest) ProtoMessage() {} -func (*ExportLogServiceRequest) Descriptor() ([]byte, []int) { return fileDescriptorLogs, []int{0} } +var xxx_messageInfo_ExportLogServiceRequest proto.InternalMessageInfo func (m *ExportLogServiceRequest) GetResourceLogs() []*ResourceLogs { if m != nil { @@ -174,25 +200,81 @@ func (m *ExportLogServiceRequest) GetResourceLogs() []*ResourceLogs { type ExportLogServiceResponse struct { } -func (m *ExportLogServiceResponse) Reset() { *m = ExportLogServiceResponse{} } -func (m *ExportLogServiceResponse) String() string { return proto.CompactTextString(m) } -func (*ExportLogServiceResponse) ProtoMessage() {} -func (*ExportLogServiceResponse) Descriptor() ([]byte, []int) { return fileDescriptorLogs, []int{1} } +func (m *ExportLogServiceResponse) Reset() { *m = ExportLogServiceResponse{} } +func (m *ExportLogServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ExportLogServiceResponse) ProtoMessage() {} +func (*ExportLogServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e9a98bab354281e, []int{1} +} +func (m *ExportLogServiceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExportLogServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExportLogServiceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExportLogServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportLogServiceResponse.Merge(m, src) +} +func (m *ExportLogServiceResponse) XXX_Size() int { + return m.Size() +} +func (m *ExportLogServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExportLogServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportLogServiceResponse proto.InternalMessageInfo // A collection of logs from a Resource. type ResourceLogs struct { // The resource for the logs in this message. // If this field is not set then no resource info is known. - Resource *opentelemetry_proto_resource_v1.Resource `protobuf:"bytes,1,opt,name=resource" json:"resource,omitempty"` - Logs []*LogRecord `protobuf:"bytes,2,rep,name=logs" json:"logs,omitempty"` + Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + Logs []*LogRecord `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` } -func (m *ResourceLogs) Reset() { *m = ResourceLogs{} } -func (m *ResourceLogs) String() string { return proto.CompactTextString(m) } -func (*ResourceLogs) ProtoMessage() {} -func (*ResourceLogs) Descriptor() ([]byte, []int) { return fileDescriptorLogs, []int{2} } +func (m *ResourceLogs) Reset() { *m = ResourceLogs{} } +func (m *ResourceLogs) String() string { return proto.CompactTextString(m) } +func (*ResourceLogs) ProtoMessage() {} +func (*ResourceLogs) Descriptor() ([]byte, []int) { + return fileDescriptor_5e9a98bab354281e, []int{2} +} +func (m *ResourceLogs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceLogs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResourceLogs.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResourceLogs) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceLogs.Merge(m, src) +} +func (m *ResourceLogs) XXX_Size() int { + return m.Size() +} +func (m *ResourceLogs) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceLogs.DiscardUnknown(m) +} -func (m *ResourceLogs) GetResource() *opentelemetry_proto_resource_v1.Resource { +var xxx_messageInfo_ResourceLogs proto.InternalMessageInfo + +func (m *ResourceLogs) GetResource() *v1.Resource { if m != nil { return m.Resource } @@ -216,7 +298,7 @@ type LogRecord struct { // is considered invalid. Can be set for logs that are part of request processing // and have an assigned trace id. Optional. TraceId []byte `protobuf:"bytes,2,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` - // A unique identifier for a log within a trace, assigned when the span + // A unique identifier for a span within a trace, assigned when the span // is created. The ID is an 8-byte array. An ID with all zeroes is considered // invalid. Can be set for logs that are part of a particular processing span. // If span_id is present trace_id SHOULD be also present. Optional. @@ -244,14 +326,42 @@ type LogRecord struct { // capable of representing it in memory so we are using string temporarily. Body string `protobuf:"bytes,8,opt,name=body,proto3" json:"body,omitempty"` // Additional attributes that describe the specific event occurrence. Optional. - Attributes []*opentelemetry_proto_common_v1.AttributeKeyValue `protobuf:"bytes,9,rep,name=attributes" json:"attributes,omitempty"` - DroppedAttributesCount uint32 `protobuf:"varint,10,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + Attributes []*v11.KeyValue `protobuf:"bytes,9,rep,name=attributes,proto3" json:"attributes,omitempty"` + DroppedAttributesCount uint32 `protobuf:"varint,10,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` } -func (m *LogRecord) Reset() { *m = LogRecord{} } -func (m *LogRecord) String() string { return proto.CompactTextString(m) } -func (*LogRecord) ProtoMessage() {} -func (*LogRecord) Descriptor() ([]byte, []int) { return fileDescriptorLogs, []int{3} } +func (m *LogRecord) Reset() { *m = LogRecord{} } +func (m *LogRecord) String() string { return proto.CompactTextString(m) } +func (*LogRecord) ProtoMessage() {} +func (*LogRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_5e9a98bab354281e, []int{3} +} +func (m *LogRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LogRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LogRecord.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LogRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogRecord.Merge(m, src) +} +func (m *LogRecord) XXX_Size() int { + return m.Size() +} +func (m *LogRecord) XXX_DiscardUnknown() { + xxx_messageInfo_LogRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_LogRecord proto.InternalMessageInfo func (m *LogRecord) GetTimestampUnixNano() uint64 { if m != nil { @@ -309,7 +419,7 @@ func (m *LogRecord) GetBody() string { return "" } -func (m *LogRecord) GetAttributes() []*opentelemetry_proto_common_v1.AttributeKeyValue { +func (m *LogRecord) GetAttributes() []*v11.KeyValue { if m != nil { return m.Attributes } @@ -324,12 +434,67 @@ func (m *LogRecord) GetDroppedAttributesCount() uint32 { } func init() { + proto.RegisterEnum("logsproto.SeverityNumber", SeverityNumber_name, SeverityNumber_value) + proto.RegisterEnum("logsproto.LogRecordFlags", LogRecordFlags_name, LogRecordFlags_value) proto.RegisterType((*ExportLogServiceRequest)(nil), "logsproto.ExportLogServiceRequest") proto.RegisterType((*ExportLogServiceResponse)(nil), "logsproto.ExportLogServiceResponse") proto.RegisterType((*ResourceLogs)(nil), "logsproto.ResourceLogs") proto.RegisterType((*LogRecord)(nil), "logsproto.LogRecord") - proto.RegisterEnum("logsproto.SeverityNumber", SeverityNumber_name, SeverityNumber_value) - proto.RegisterEnum("logsproto.LogRecordFlags", LogRecordFlags_name, LogRecordFlags_value) +} + +func init() { proto.RegisterFile("logs/v1/logs.proto", fileDescriptor_5e9a98bab354281e) } + +var fileDescriptor_5e9a98bab354281e = []byte{ + // 773 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xc1, 0x6e, 0xe2, 0x46, + 0x18, 0xc7, 0x71, 0x42, 0x08, 0x7c, 0x21, 0xec, 0xec, 0x6c, 0x76, 0xe3, 0x44, 0x5a, 0x84, 0xd8, + 0x43, 0x69, 0xa4, 0xc5, 0x8a, 0xe1, 0xd0, 0x43, 0x2f, 0x24, 0x31, 0x11, 0x0a, 0x6b, 0xa4, 0x01, + 0x76, 0xd5, 0x5e, 0x2c, 0x83, 0xa7, 0xd4, 0x12, 0xf6, 0xb8, 0xe3, 0x01, 0xc1, 0xa9, 0xaf, 0xd0, + 0x87, 0xe8, 0x8b, 0xf4, 0xd6, 0xe3, 0x1e, 0x7b, 0xac, 0x92, 0x07, 0x69, 0x35, 0x03, 0x9e, 0x85, + 0x36, 0xed, 0x89, 0xdf, 0xf7, 0xff, 0xfe, 0x9f, 0xe7, 0xef, 0x61, 0x3c, 0x80, 0xe7, 0x6c, 0x96, + 0x5a, 0xcb, 0x6b, 0x4b, 0xfe, 0x36, 0x13, 0xce, 0x04, 0xc3, 0x25, 0xc9, 0x0a, 0x2f, 0xaf, 0x58, + 0x42, 0x63, 0x41, 0xe7, 0x34, 0xa2, 0x82, 0xaf, 0x2d, 0x25, 0x5a, 0x53, 0x16, 0x45, 0x2c, 0x96, + 0x43, 0x1b, 0xda, 0x8c, 0x5d, 0x36, 0x9f, 0xf3, 0x72, 0x9a, 0xb2, 0x05, 0x9f, 0x52, 0xe9, 0xce, + 0x78, 0xe3, 0xaf, 0x7f, 0x82, 0x73, 0x67, 0x95, 0x30, 0x2e, 0xfa, 0x6c, 0x36, 0xa4, 0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6a, 0xfc, 0xf9, 0x58, + 0x35, 0x7e, 0x79, 0xaa, 0xe6, 0x3e, 0x3f, 0x55, 0x73, 0x7f, 0x3c, 0x55, 0x73, 0xdf, 0x3f, 0xcc, + 0xd8, 0x3f, 0x4e, 0x5e, 0x28, 0x6f, 0xc0, 0xf9, 0x9c, 0x4e, 0x05, 0xe3, 0x56, 0x18, 0x0b, 0xca, + 0x63, 0x7f, 0x6e, 0x05, 0xbe, 0xf0, 0xad, 0x3d, 0xe3, 0x7b, 0xb5, 0xea, 0xfb, 0x19, 0x8d, 0xad, + 0xed, 0x25, 0x3b, 0x29, 0x28, 0xa9, 0xf5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x64, 0xcc, + 0x08, 0x76, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -340,8 +505,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for LogService service - +// LogServiceClient is the client API for LogService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type LogServiceClient interface { // For performance reasons, it is recommended to keep this RPC // alive for the entire life of the application. @@ -358,21 +524,28 @@ func NewLogServiceClient(cc *grpc.ClientConn) LogServiceClient { func (c *logServiceClient) Export(ctx context.Context, in *ExportLogServiceRequest, opts ...grpc.CallOption) (*ExportLogServiceResponse, error) { out := new(ExportLogServiceResponse) - err := grpc.Invoke(ctx, "/logsproto.LogService/Export", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/logsproto.LogService/Export", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for LogService service - +// LogServiceServer is the server API for LogService service. type LogServiceServer interface { // For performance reasons, it is recommended to keep this RPC // alive for the entire life of the application. Export(context.Context, *ExportLogServiceRequest) (*ExportLogServiceResponse, error) } +// UnimplementedLogServiceServer can be embedded to have forward compatible implementations. +type UnimplementedLogServiceServer struct { +} + +func (*UnimplementedLogServiceServer) Export(ctx context.Context, req *ExportLogServiceRequest) (*ExportLogServiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Export not implemented") +} + func RegisterLogServiceServer(s *grpc.Server, srv LogServiceServer) { s.RegisterService(&_LogService_serviceDesc, srv) } @@ -411,7 +584,7 @@ var _LogService_serviceDesc = grpc.ServiceDesc{ func (m *ExportLogServiceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -419,29 +592,36 @@ func (m *ExportLogServiceRequest) Marshal() (dAtA []byte, err error) { } func (m *ExportLogServiceRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExportLogServiceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if len(m.ResourceLogs) > 0 { - for _, msg := range m.ResourceLogs { - dAtA[i] = 0xa - i++ - i = encodeVarintLogs(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.ResourceLogs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceLogs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLogs(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *ExportLogServiceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -449,17 +629,22 @@ func (m *ExportLogServiceResponse) Marshal() (dAtA []byte, err error) { } func (m *ExportLogServiceResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExportLogServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + return len(dAtA) - i, nil } func (m *ResourceLogs) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -467,39 +652,48 @@ func (m *ResourceLogs) Marshal() (dAtA []byte, err error) { } func (m *ResourceLogs) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceLogs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Resource != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintLogs(dAtA, i, uint64(m.Resource.Size())) - n1, err := m.Resource.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } if len(m.Logs) > 0 { - for _, msg := range m.Logs { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLogs(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintLogs(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Resource != nil { + { + size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintLogs(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LogRecord) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -507,103 +701,103 @@ func (m *LogRecord) Marshal() (dAtA []byte, err error) { } func (m *LogRecord) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LogRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TimestampUnixNano != 0 { - dAtA[i] = 0x9 - i++ - i = encodeFixed64Logs(dAtA, i, uint64(m.TimestampUnixNano)) - } - if len(m.TraceId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintLogs(dAtA, i, uint64(len(m.TraceId))) - i += copy(dAtA[i:], m.TraceId) + if m.DroppedAttributesCount != 0 { + i = encodeVarintLogs(dAtA, i, uint64(m.DroppedAttributesCount)) + i-- + dAtA[i] = 0x50 } - if len(m.SpanId) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintLogs(dAtA, i, uint64(len(m.SpanId))) - i += copy(dAtA[i:], m.SpanId) + if len(m.Attributes) > 0 { + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLogs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } } - if m.Flags != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintLogs(dAtA, i, uint64(m.Flags)) + if len(m.Body) > 0 { + i -= len(m.Body) + copy(dAtA[i:], m.Body) + i = encodeVarintLogs(dAtA, i, uint64(len(m.Body))) + i-- + dAtA[i] = 0x42 } - if m.SeverityNumber != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintLogs(dAtA, i, uint64(m.SeverityNumber)) + if len(m.ShortName) > 0 { + i -= len(m.ShortName) + copy(dAtA[i:], m.ShortName) + i = encodeVarintLogs(dAtA, i, uint64(len(m.ShortName))) + i-- + dAtA[i] = 0x3a } if len(m.SeverityText) > 0 { - dAtA[i] = 0x32 - i++ + i -= len(m.SeverityText) + copy(dAtA[i:], m.SeverityText) i = encodeVarintLogs(dAtA, i, uint64(len(m.SeverityText))) - i += copy(dAtA[i:], m.SeverityText) + i-- + dAtA[i] = 0x32 } - if len(m.ShortName) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintLogs(dAtA, i, uint64(len(m.ShortName))) - i += copy(dAtA[i:], m.ShortName) + if m.SeverityNumber != 0 { + i = encodeVarintLogs(dAtA, i, uint64(m.SeverityNumber)) + i-- + dAtA[i] = 0x28 } - if len(m.Body) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintLogs(dAtA, i, uint64(len(m.Body))) - i += copy(dAtA[i:], m.Body) + if m.Flags != 0 { + i = encodeVarintLogs(dAtA, i, uint64(m.Flags)) + i-- + dAtA[i] = 0x20 } - if len(m.Attributes) > 0 { - for _, msg := range m.Attributes { - dAtA[i] = 0x4a - i++ - i = encodeVarintLogs(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if len(m.SpanId) > 0 { + i -= len(m.SpanId) + copy(dAtA[i:], m.SpanId) + i = encodeVarintLogs(dAtA, i, uint64(len(m.SpanId))) + i-- + dAtA[i] = 0x1a } - if m.DroppedAttributesCount != 0 { - dAtA[i] = 0x50 - i++ - i = encodeVarintLogs(dAtA, i, uint64(m.DroppedAttributesCount)) + if len(m.TraceId) > 0 { + i -= len(m.TraceId) + copy(dAtA[i:], m.TraceId) + i = encodeVarintLogs(dAtA, i, uint64(len(m.TraceId))) + i-- + dAtA[i] = 0x12 } - return i, nil + if m.TimestampUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.TimestampUnixNano)) + i-- + dAtA[i] = 0x9 + } + return len(dAtA) - i, nil } -func encodeFixed64Logs(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Logs(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintLogs(dAtA []byte, offset int, v uint64) int { + offset -= sovLogs(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ExportLogServiceRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.ResourceLogs) > 0 { @@ -616,12 +810,18 @@ func (m *ExportLogServiceRequest) Size() (n int) { } func (m *ExportLogServiceResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l return n } func (m *ResourceLogs) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Resource != nil { @@ -638,6 +838,9 @@ func (m *ResourceLogs) Size() (n int) { } func (m *LogRecord) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.TimestampUnixNano != 0 { @@ -682,14 +885,7 @@ func (m *LogRecord) Size() (n int) { } func sovLogs(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozLogs(x uint64) (n int) { return sovLogs(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -709,7 +905,7 @@ func (m *ExportLogServiceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -737,7 +933,7 @@ func (m *ExportLogServiceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -746,6 +942,9 @@ func (m *ExportLogServiceRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -763,6 +962,9 @@ func (m *ExportLogServiceRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthLogs } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthLogs + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -790,7 +992,7 @@ func (m *ExportLogServiceResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -813,6 +1015,9 @@ func (m *ExportLogServiceResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthLogs } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthLogs + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -840,7 +1045,7 @@ func (m *ResourceLogs) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -868,7 +1073,7 @@ func (m *ResourceLogs) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -877,11 +1082,14 @@ func (m *ResourceLogs) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } if m.Resource == nil { - m.Resource = &opentelemetry_proto_resource_v1.Resource{} + m.Resource = &v1.Resource{} } if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -901,7 +1109,7 @@ func (m *ResourceLogs) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -910,6 +1118,9 @@ func (m *ResourceLogs) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -927,6 +1138,9 @@ func (m *ResourceLogs) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthLogs } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthLogs + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -954,7 +1168,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -976,15 +1190,8 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.TimestampUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.TimestampUnixNano = uint64(dAtA[iNdEx-8]) - m.TimestampUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.TimestampUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.TimestampUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.TimestampUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.TimestampUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.TimestampUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.TimestampUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TraceId", wireType) @@ -999,7 +1206,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1008,6 +1215,9 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1030,7 +1240,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1039,6 +1249,9 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1061,7 +1274,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Flags |= (uint32(b) & 0x7F) << shift + m.Flags |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1080,7 +1293,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SeverityNumber |= (SeverityNumber(b) & 0x7F) << shift + m.SeverityNumber |= SeverityNumber(b&0x7F) << shift if b < 0x80 { break } @@ -1099,7 +1312,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1109,6 +1322,9 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1128,7 +1344,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1138,6 +1354,9 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1157,7 +1376,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1167,6 +1386,9 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1186,7 +1408,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1195,10 +1417,13 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLogs } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLogs + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Attributes = append(m.Attributes, &opentelemetry_proto_common_v1.AttributeKeyValue{}) + m.Attributes = append(m.Attributes, &v11.KeyValue{}) if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1217,7 +1442,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DroppedAttributesCount |= (uint32(b) & 0x7F) << shift + m.DroppedAttributesCount |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1231,6 +1456,9 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthLogs } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthLogs + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1246,6 +1474,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error { func skipLogs(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1277,10 +1506,8 @@ func skipLogs(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1297,108 +1524,34 @@ func skipLogs(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthLogs } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowLogs - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipLogs(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLogs + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthLogs + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthLogs = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowLogs = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthLogs = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLogs = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLogs = fmt.Errorf("proto: unexpected end of group") ) - -func init() { proto.RegisterFile("logs/v1/logs.proto", fileDescriptorLogs) } - -var fileDescriptorLogs = []byte{ - // 769 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0x41, 0x6f, 0xe2, 0x46, - 0x14, 0xc7, 0xe3, 0x84, 0x10, 0x78, 0x21, 0xec, 0xec, 0x6c, 0x76, 0xe3, 0x44, 0x5a, 0x84, 0xd8, - 0x0b, 0x8d, 0xb4, 0xb8, 0x31, 0x1c, 0x7a, 0xe8, 0x05, 0x82, 0x89, 0x50, 0x58, 0x53, 0x0d, 0xb0, - 0xab, 0x56, 0xaa, 0x2c, 0x83, 0xa7, 0xd4, 0x12, 0xf6, 0xb8, 0xe3, 0x01, 0xc1, 0xa9, 0x5f, 0xa1, - 0x5f, 0xa4, 0x1f, 0xa2, 0xb7, 0x1e, 0xfb, 0x11, 0xaa, 0xf4, 0x83, 0xb4, 0x9a, 0x01, 0xcf, 0x42, - 0xbb, 0xdd, 0x53, 0x7e, 0xef, 0xbd, 0xff, 0x9b, 0xf9, 0xe7, 0xf1, 0x3c, 0x80, 0x17, 0x6c, 0x9e, - 0x5a, 0xab, 0x3b, 0x4b, 0xfe, 0x6d, 0x24, 0x9c, 0x09, 0x86, 0x8b, 0x92, 0x15, 0xde, 0xdc, 0xb2, - 0x84, 0xc6, 0x82, 0x2e, 0x68, 0x44, 0x05, 0xdf, 0x58, 0x2a, 0x69, 0xcd, 0x58, 0x14, 0xb1, 0x58, - 0x36, 0x6d, 0x69, 0xdb, 0x76, 0xd3, 0xf8, 0x94, 0x96, 0xd3, 0x94, 0x2d, 0xf9, 0x8c, 0x4a, 0x75, - 0xc6, 0x5b, 0x7d, 0xed, 0x03, 0x5c, 0x39, 0xeb, 0x84, 0x71, 0x31, 0x60, 0xf3, 0x11, 0xe5, 0xab, - 0x70, 0x46, 0x09, 0xfd, 0x69, 0x49, 0x53, 0x81, 0xbf, 0x86, 0x8b, 0x4c, 0xec, 0x49, 0x33, 0xa6, - 0x51, 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x82, 0xce, 0x04, 0xe3, 0x56, 0x18, 0x0b, 0xca, 0x63, 0x7f, 0x61, 0x05, - 0xbe, 0xf0, 0xad, 0x03, 0xe1, 0x5b, 0x75, 0xdb, 0xdb, 0x39, 0x8d, 0xad, 0xdd, 0x2b, 0x3b, 0xcd, - 0xab, 0x54, 0xf3, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0x90, 0x92, 0x61, 0x77, 0x05, 0x00, - 0x00, -} diff --git a/internal/data/opentelemetry-proto-gen/metrics/v1/metrics.pb.go b/internal/data/opentelemetry-proto-gen/metrics/v1/metrics.pb.go index e867ec9f0274..fb3ddb638cdd 100644 --- a/internal/data/opentelemetry-proto-gen/metrics/v1/metrics.pb.go +++ b/internal/data/opentelemetry-proto-gen/metrics/v1/metrics.pb.go @@ -1,31 +1,18 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: opentelemetry/proto/metrics/v1/metrics.proto -/* - Package v1 is a generated protocol buffer package. - - It is generated from these files: - opentelemetry/proto/metrics/v1/metrics.proto - - It has these top-level messages: - ResourceMetrics - InstrumentationLibraryMetrics - Metric - MetricDescriptor - Int64DataPoint - DoubleDataPoint - HistogramDataPoint - SummaryDataPoint -*/ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import opentelemetry_proto_common_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" -import opentelemetry_proto_resource_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1" - -import io "io" +import ( + encoding_binary "encoding/binary" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + v11 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" + v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -36,7 +23,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Type is the type of values a metric has. type MetricDescriptor_Type int32 @@ -83,6 +70,7 @@ var MetricDescriptor_Type_name = map[int32]string{ 5: "HISTOGRAM", 6: "SUMMARY", } + var MetricDescriptor_Type_value = map[string]int32{ "INVALID_TYPE": 0, "INT64": 1, @@ -96,8 +84,9 @@ var MetricDescriptor_Type_value = map[string]int32{ func (x MetricDescriptor_Type) String() string { return proto.EnumName(MetricDescriptor_Type_name, int32(x)) } + func (MetricDescriptor_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptorMetrics, []int{3, 0} + return fileDescriptor_3c3112f9fa006917, []int{3, 0} } // Temporality is the temporal quality values of a metric have. It @@ -179,6 +168,7 @@ var MetricDescriptor_Temporality_name = map[int32]string{ 2: "DELTA", 3: "CUMULATIVE", } + var MetricDescriptor_Temporality_value = map[string]int32{ "INVALID_TEMPORALITY": 0, "INSTANTANEOUS": 1, @@ -189,25 +179,54 @@ var MetricDescriptor_Temporality_value = map[string]int32{ func (x MetricDescriptor_Temporality) String() string { return proto.EnumName(MetricDescriptor_Temporality_name, int32(x)) } + func (MetricDescriptor_Temporality) EnumDescriptor() ([]byte, []int) { - return fileDescriptorMetrics, []int{3, 1} + return fileDescriptor_3c3112f9fa006917, []int{3, 1} } // A collection of InstrumentationLibraryMetrics from a Resource. type ResourceMetrics struct { // The resource for the metrics in this message. // If this field is not set then no resource info is known. - Resource *opentelemetry_proto_resource_v1.Resource `protobuf:"bytes,1,opt,name=resource" json:"resource,omitempty"` + Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` // A list of metrics that originate from a resource. - InstrumentationLibraryMetrics []*InstrumentationLibraryMetrics `protobuf:"bytes,2,rep,name=instrumentation_library_metrics,json=instrumentationLibraryMetrics" json:"instrumentation_library_metrics,omitempty"` + InstrumentationLibraryMetrics []*InstrumentationLibraryMetrics `protobuf:"bytes,2,rep,name=instrumentation_library_metrics,json=instrumentationLibraryMetrics,proto3" json:"instrumentation_library_metrics,omitempty"` } -func (m *ResourceMetrics) Reset() { *m = ResourceMetrics{} } -func (m *ResourceMetrics) String() string { return proto.CompactTextString(m) } -func (*ResourceMetrics) ProtoMessage() {} -func (*ResourceMetrics) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{0} } +func (m *ResourceMetrics) Reset() { *m = ResourceMetrics{} } +func (m *ResourceMetrics) String() string { return proto.CompactTextString(m) } +func (*ResourceMetrics) ProtoMessage() {} +func (*ResourceMetrics) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{0} +} +func (m *ResourceMetrics) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResourceMetrics.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResourceMetrics) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceMetrics.Merge(m, src) +} +func (m *ResourceMetrics) XXX_Size() int { + return m.Size() +} +func (m *ResourceMetrics) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceMetrics.DiscardUnknown(m) +} -func (m *ResourceMetrics) GetResource() *opentelemetry_proto_resource_v1.Resource { +var xxx_messageInfo_ResourceMetrics proto.InternalMessageInfo + +func (m *ResourceMetrics) GetResource() *v1.Resource { if m != nil { return m.Resource } @@ -225,19 +244,45 @@ func (m *ResourceMetrics) GetInstrumentationLibraryMetrics() []*InstrumentationL type InstrumentationLibraryMetrics struct { // The instrumentation library information for the metrics in this message. // If this field is not set then no library info is known. - InstrumentationLibrary *opentelemetry_proto_common_v1.InstrumentationLibrary `protobuf:"bytes,1,opt,name=instrumentation_library,json=instrumentationLibrary" json:"instrumentation_library,omitempty"` + InstrumentationLibrary *v11.InstrumentationLibrary `protobuf:"bytes,1,opt,name=instrumentation_library,json=instrumentationLibrary,proto3" json:"instrumentation_library,omitempty"` // A list of metrics that originate from an instrumentation library. - Metrics []*Metric `protobuf:"bytes,2,rep,name=metrics" json:"metrics,omitempty"` + Metrics []*Metric `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics,omitempty"` } func (m *InstrumentationLibraryMetrics) Reset() { *m = InstrumentationLibraryMetrics{} } func (m *InstrumentationLibraryMetrics) String() string { return proto.CompactTextString(m) } func (*InstrumentationLibraryMetrics) ProtoMessage() {} func (*InstrumentationLibraryMetrics) Descriptor() ([]byte, []int) { - return fileDescriptorMetrics, []int{1} + return fileDescriptor_3c3112f9fa006917, []int{1} +} +func (m *InstrumentationLibraryMetrics) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *InstrumentationLibraryMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InstrumentationLibraryMetrics.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *InstrumentationLibraryMetrics) XXX_Merge(src proto.Message) { + xxx_messageInfo_InstrumentationLibraryMetrics.Merge(m, src) +} +func (m *InstrumentationLibraryMetrics) XXX_Size() int { + return m.Size() +} +func (m *InstrumentationLibraryMetrics) XXX_DiscardUnknown() { + xxx_messageInfo_InstrumentationLibraryMetrics.DiscardUnknown(m) } -func (m *InstrumentationLibraryMetrics) GetInstrumentationLibrary() *opentelemetry_proto_common_v1.InstrumentationLibrary { +var xxx_messageInfo_InstrumentationLibraryMetrics proto.InternalMessageInfo + +func (m *InstrumentationLibraryMetrics) GetInstrumentationLibrary() *v11.InstrumentationLibrary { if m != nil { return m.InstrumentationLibrary } @@ -293,7 +338,7 @@ func (m *InstrumentationLibraryMetrics) GetMetrics() []*Metric { // |+-----+ | // +---------------------------+ // -// ----------------------------------------------------------------------- +//----------------------------------------------------------------------- // DataPoint is a value of specific type corresponding to a given moment in // time. Each DataPoint is timestamped. // @@ -302,20 +347,48 @@ func (m *InstrumentationLibraryMetrics) GetMetrics() []*Metric { // messages, which correspond to the types of metric values. type Metric struct { // metric_descriptor describes the Metric. - MetricDescriptor *MetricDescriptor `protobuf:"bytes,1,opt,name=metric_descriptor,json=metricDescriptor" json:"metric_descriptor,omitempty"` + MetricDescriptor *MetricDescriptor `protobuf:"bytes,1,opt,name=metric_descriptor,json=metricDescriptor,proto3" json:"metric_descriptor,omitempty"` // Data is a list of one or more DataPoints for a single metric. Only one of the // following fields is used for the data, depending on the type of the metric defined // by MetricDescriptor.type field. - Int64DataPoints []*Int64DataPoint `protobuf:"bytes,2,rep,name=int64_data_points,json=int64DataPoints" json:"int64_data_points,omitempty"` - DoubleDataPoints []*DoubleDataPoint `protobuf:"bytes,3,rep,name=double_data_points,json=doubleDataPoints" json:"double_data_points,omitempty"` - HistogramDataPoints []*HistogramDataPoint `protobuf:"bytes,4,rep,name=histogram_data_points,json=histogramDataPoints" json:"histogram_data_points,omitempty"` - SummaryDataPoints []*SummaryDataPoint `protobuf:"bytes,5,rep,name=summary_data_points,json=summaryDataPoints" json:"summary_data_points,omitempty"` + Int64DataPoints []*Int64DataPoint `protobuf:"bytes,2,rep,name=int64_data_points,json=int64DataPoints,proto3" json:"int64_data_points,omitempty"` + DoubleDataPoints []*DoubleDataPoint `protobuf:"bytes,3,rep,name=double_data_points,json=doubleDataPoints,proto3" json:"double_data_points,omitempty"` + HistogramDataPoints []*HistogramDataPoint `protobuf:"bytes,4,rep,name=histogram_data_points,json=histogramDataPoints,proto3" json:"histogram_data_points,omitempty"` + SummaryDataPoints []*SummaryDataPoint `protobuf:"bytes,5,rep,name=summary_data_points,json=summaryDataPoints,proto3" json:"summary_data_points,omitempty"` +} + +func (m *Metric) Reset() { *m = Metric{} } +func (m *Metric) String() string { return proto.CompactTextString(m) } +func (*Metric) ProtoMessage() {} +func (*Metric) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{2} +} +func (m *Metric) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Metric.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Metric) XXX_Merge(src proto.Message) { + xxx_messageInfo_Metric.Merge(m, src) +} +func (m *Metric) XXX_Size() int { + return m.Size() +} +func (m *Metric) XXX_DiscardUnknown() { + xxx_messageInfo_Metric.DiscardUnknown(m) } -func (m *Metric) Reset() { *m = Metric{} } -func (m *Metric) String() string { return proto.CompactTextString(m) } -func (*Metric) ProtoMessage() {} -func (*Metric) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{2} } +var xxx_messageInfo_Metric proto.InternalMessageInfo func (m *Metric) GetMetricDescriptor() *MetricDescriptor { if m != nil { @@ -367,10 +440,38 @@ type MetricDescriptor struct { Temporality MetricDescriptor_Temporality `protobuf:"varint,5,opt,name=temporality,proto3,enum=opentelemetry.proto.metrics.v1.MetricDescriptor_Temporality" json:"temporality,omitempty"` } -func (m *MetricDescriptor) Reset() { *m = MetricDescriptor{} } -func (m *MetricDescriptor) String() string { return proto.CompactTextString(m) } -func (*MetricDescriptor) ProtoMessage() {} -func (*MetricDescriptor) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{3} } +func (m *MetricDescriptor) Reset() { *m = MetricDescriptor{} } +func (m *MetricDescriptor) String() string { return proto.CompactTextString(m) } +func (*MetricDescriptor) ProtoMessage() {} +func (*MetricDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{3} +} +func (m *MetricDescriptor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MetricDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MetricDescriptor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MetricDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetricDescriptor.Merge(m, src) +} +func (m *MetricDescriptor) XXX_Size() int { + return m.Size() +} +func (m *MetricDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_MetricDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_MetricDescriptor proto.InternalMessageInfo func (m *MetricDescriptor) GetName() string { if m != nil { @@ -411,7 +512,7 @@ func (m *MetricDescriptor) GetTemporality() MetricDescriptor_Temporality { // values of a int64 metric. type Int64DataPoint struct { // The set of labels that uniquely identify this timeseries. - Labels []*opentelemetry_proto_common_v1.StringKeyValue `protobuf:"bytes,1,rep,name=labels" json:"labels,omitempty"` + Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` // start_time_unix_nano is the time when the cumulative value was reset to zero. // This is used for Counter type only. For Gauge the value is not specified and // defaults to 0. @@ -429,12 +530,40 @@ type Int64DataPoint struct { Value int64 `protobuf:"varint,4,opt,name=value,proto3" json:"value,omitempty"` } -func (m *Int64DataPoint) Reset() { *m = Int64DataPoint{} } -func (m *Int64DataPoint) String() string { return proto.CompactTextString(m) } -func (*Int64DataPoint) ProtoMessage() {} -func (*Int64DataPoint) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{4} } +func (m *Int64DataPoint) Reset() { *m = Int64DataPoint{} } +func (m *Int64DataPoint) String() string { return proto.CompactTextString(m) } +func (*Int64DataPoint) ProtoMessage() {} +func (*Int64DataPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{4} +} +func (m *Int64DataPoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Int64DataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Int64DataPoint.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Int64DataPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int64DataPoint.Merge(m, src) +} +func (m *Int64DataPoint) XXX_Size() int { + return m.Size() +} +func (m *Int64DataPoint) XXX_DiscardUnknown() { + xxx_messageInfo_Int64DataPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_Int64DataPoint proto.InternalMessageInfo -func (m *Int64DataPoint) GetLabels() []*opentelemetry_proto_common_v1.StringKeyValue { +func (m *Int64DataPoint) GetLabels() []*v11.StringKeyValue { if m != nil { return m.Labels } @@ -466,7 +595,7 @@ func (m *Int64DataPoint) GetValue() int64 { // value of a double metric. type DoubleDataPoint struct { // The set of labels that uniquely identify this timeseries. - Labels []*opentelemetry_proto_common_v1.StringKeyValue `protobuf:"bytes,1,rep,name=labels" json:"labels,omitempty"` + Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` // start_time_unix_nano is the time when the cumulative value was reset to zero. // This is used for Counter type only. For Gauge the value is not specified and // defaults to 0. @@ -484,12 +613,40 @@ type DoubleDataPoint struct { Value float64 `protobuf:"fixed64,4,opt,name=value,proto3" json:"value,omitempty"` } -func (m *DoubleDataPoint) Reset() { *m = DoubleDataPoint{} } -func (m *DoubleDataPoint) String() string { return proto.CompactTextString(m) } -func (*DoubleDataPoint) ProtoMessage() {} -func (*DoubleDataPoint) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{5} } +func (m *DoubleDataPoint) Reset() { *m = DoubleDataPoint{} } +func (m *DoubleDataPoint) String() string { return proto.CompactTextString(m) } +func (*DoubleDataPoint) ProtoMessage() {} +func (*DoubleDataPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{5} +} +func (m *DoubleDataPoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DoubleDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DoubleDataPoint.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DoubleDataPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_DoubleDataPoint.Merge(m, src) +} +func (m *DoubleDataPoint) XXX_Size() int { + return m.Size() +} +func (m *DoubleDataPoint) XXX_DiscardUnknown() { + xxx_messageInfo_DoubleDataPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_DoubleDataPoint proto.InternalMessageInfo -func (m *DoubleDataPoint) GetLabels() []*opentelemetry_proto_common_v1.StringKeyValue { +func (m *DoubleDataPoint) GetLabels() []*v11.StringKeyValue { if m != nil { return m.Labels } @@ -522,7 +679,7 @@ func (m *DoubleDataPoint) GetValue() float64 { // it may optionally contain the distribution of those values across a set of buckets. type HistogramDataPoint struct { // The set of labels that uniquely identify this timeseries. - Labels []*opentelemetry_proto_common_v1.StringKeyValue `protobuf:"bytes,1,rep,name=labels" json:"labels,omitempty"` + Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` // start_time_unix_nano is the time when the cumulative value was reset to zero. // // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. @@ -552,7 +709,7 @@ type HistogramDataPoint struct { // Note: if HistogramDataPoint.bucket_options defines bucket bounds then this field // must also be present and number of elements in this field must be equal to the // number of buckets defined by bucket_options. - Buckets []*HistogramDataPoint_Bucket `protobuf:"bytes,6,rep,name=buckets" json:"buckets,omitempty"` + Buckets []*HistogramDataPoint_Bucket `protobuf:"bytes,6,rep,name=buckets,proto3" json:"buckets,omitempty"` // explicit_bounds specifies buckets with explicitly defined bounds for values. // The bucket boundaries are described by "bounds" field. // @@ -567,15 +724,43 @@ type HistogramDataPoint struct { // Note: only [a, b) intervals are currently supported for each bucket. If we decides // to also support (a, b] intervals we should add support for these by defining a boolean // value which decides what type of intervals to use. - ExplicitBounds []float64 `protobuf:"fixed64,7,rep,packed,name=explicit_bounds,json=explicitBounds" json:"explicit_bounds,omitempty"` + ExplicitBounds []float64 `protobuf:"fixed64,7,rep,packed,name=explicit_bounds,json=explicitBounds,proto3" json:"explicit_bounds,omitempty"` +} + +func (m *HistogramDataPoint) Reset() { *m = HistogramDataPoint{} } +func (m *HistogramDataPoint) String() string { return proto.CompactTextString(m) } +func (*HistogramDataPoint) ProtoMessage() {} +func (*HistogramDataPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{6} +} +func (m *HistogramDataPoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistogramDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistogramDataPoint.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HistogramDataPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramDataPoint.Merge(m, src) +} +func (m *HistogramDataPoint) XXX_Size() int { + return m.Size() +} +func (m *HistogramDataPoint) XXX_DiscardUnknown() { + xxx_messageInfo_HistogramDataPoint.DiscardUnknown(m) } -func (m *HistogramDataPoint) Reset() { *m = HistogramDataPoint{} } -func (m *HistogramDataPoint) String() string { return proto.CompactTextString(m) } -func (*HistogramDataPoint) ProtoMessage() {} -func (*HistogramDataPoint) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{6} } +var xxx_messageInfo_HistogramDataPoint proto.InternalMessageInfo -func (m *HistogramDataPoint) GetLabels() []*opentelemetry_proto_common_v1.StringKeyValue { +func (m *HistogramDataPoint) GetLabels() []*v11.StringKeyValue { if m != nil { return m.Labels } @@ -630,15 +815,41 @@ type HistogramDataPoint_Bucket struct { // bucket_options. Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` // exemplar is an optional representative value of the bucket. - Exemplar *HistogramDataPoint_Bucket_Exemplar `protobuf:"bytes,2,opt,name=exemplar" json:"exemplar,omitempty"` + Exemplar *HistogramDataPoint_Bucket_Exemplar `protobuf:"bytes,2,opt,name=exemplar,proto3" json:"exemplar,omitempty"` } func (m *HistogramDataPoint_Bucket) Reset() { *m = HistogramDataPoint_Bucket{} } func (m *HistogramDataPoint_Bucket) String() string { return proto.CompactTextString(m) } func (*HistogramDataPoint_Bucket) ProtoMessage() {} func (*HistogramDataPoint_Bucket) Descriptor() ([]byte, []int) { - return fileDescriptorMetrics, []int{6, 0} + return fileDescriptor_3c3112f9fa006917, []int{6, 0} +} +func (m *HistogramDataPoint_Bucket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistogramDataPoint_Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistogramDataPoint_Bucket.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } +func (m *HistogramDataPoint_Bucket) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramDataPoint_Bucket.Merge(m, src) +} +func (m *HistogramDataPoint_Bucket) XXX_Size() int { + return m.Size() +} +func (m *HistogramDataPoint_Bucket) XXX_DiscardUnknown() { + xxx_messageInfo_HistogramDataPoint_Bucket.DiscardUnknown(m) +} + +var xxx_messageInfo_HistogramDataPoint_Bucket proto.InternalMessageInfo func (m *HistogramDataPoint_Bucket) GetCount() uint64 { if m != nil { @@ -667,15 +878,41 @@ type HistogramDataPoint_Bucket_Exemplar struct { TimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` // exemplar_attachments are contextual information about the example value. // Keys in this list must be unique. - Attachments []*opentelemetry_proto_common_v1.StringKeyValue `protobuf:"bytes,3,rep,name=attachments" json:"attachments,omitempty"` + Attachments []*v11.StringKeyValue `protobuf:"bytes,3,rep,name=attachments,proto3" json:"attachments,omitempty"` } func (m *HistogramDataPoint_Bucket_Exemplar) Reset() { *m = HistogramDataPoint_Bucket_Exemplar{} } func (m *HistogramDataPoint_Bucket_Exemplar) String() string { return proto.CompactTextString(m) } func (*HistogramDataPoint_Bucket_Exemplar) ProtoMessage() {} func (*HistogramDataPoint_Bucket_Exemplar) Descriptor() ([]byte, []int) { - return fileDescriptorMetrics, []int{6, 0, 0} + return fileDescriptor_3c3112f9fa006917, []int{6, 0, 0} +} +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Merge(m, src) +} +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Size() int { + return m.Size() } +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_DiscardUnknown() { + xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.DiscardUnknown(m) +} + +var xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar proto.InternalMessageInfo func (m *HistogramDataPoint_Bucket_Exemplar) GetValue() float64 { if m != nil { @@ -691,7 +928,7 @@ func (m *HistogramDataPoint_Bucket_Exemplar) GetTimeUnixNano() uint64 { return 0 } -func (m *HistogramDataPoint_Bucket_Exemplar) GetAttachments() []*opentelemetry_proto_common_v1.StringKeyValue { +func (m *HistogramDataPoint_Bucket_Exemplar) GetAttachments() []*v11.StringKeyValue { if m != nil { return m.Attachments } @@ -702,7 +939,7 @@ func (m *HistogramDataPoint_Bucket_Exemplar) GetAttachments() []*opentelemetry_p // values of a Summary metric. type SummaryDataPoint struct { // The set of labels that uniquely identify this timeseries. - Labels []*opentelemetry_proto_common_v1.StringKeyValue `protobuf:"bytes,1,rep,name=labels" json:"labels,omitempty"` + Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` // start_time_unix_nano is the time when the cumulative value was reset to zero. // // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. @@ -722,15 +959,43 @@ type SummaryDataPoint struct { Sum float64 `protobuf:"fixed64,5,opt,name=sum,proto3" json:"sum,omitempty"` // A list of values at different percentiles of the distribution calculated // from the current snapshot. The percentiles must be strictly increasing. - PercentileValues []*SummaryDataPoint_ValueAtPercentile `protobuf:"bytes,6,rep,name=percentile_values,json=percentileValues" json:"percentile_values,omitempty"` + PercentileValues []*SummaryDataPoint_ValueAtPercentile `protobuf:"bytes,6,rep,name=percentile_values,json=percentileValues,proto3" json:"percentile_values,omitempty"` } -func (m *SummaryDataPoint) Reset() { *m = SummaryDataPoint{} } -func (m *SummaryDataPoint) String() string { return proto.CompactTextString(m) } -func (*SummaryDataPoint) ProtoMessage() {} -func (*SummaryDataPoint) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{7} } +func (m *SummaryDataPoint) Reset() { *m = SummaryDataPoint{} } +func (m *SummaryDataPoint) String() string { return proto.CompactTextString(m) } +func (*SummaryDataPoint) ProtoMessage() {} +func (*SummaryDataPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{7} +} +func (m *SummaryDataPoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SummaryDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SummaryDataPoint.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SummaryDataPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_SummaryDataPoint.Merge(m, src) +} +func (m *SummaryDataPoint) XXX_Size() int { + return m.Size() +} +func (m *SummaryDataPoint) XXX_DiscardUnknown() { + xxx_messageInfo_SummaryDataPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_SummaryDataPoint proto.InternalMessageInfo -func (m *SummaryDataPoint) GetLabels() []*opentelemetry_proto_common_v1.StringKeyValue { +func (m *SummaryDataPoint) GetLabels() []*v11.StringKeyValue { if m != nil { return m.Labels } @@ -792,8 +1057,34 @@ func (m *SummaryDataPoint_ValueAtPercentile) Reset() { *m = SummaryDataP func (m *SummaryDataPoint_ValueAtPercentile) String() string { return proto.CompactTextString(m) } func (*SummaryDataPoint_ValueAtPercentile) ProtoMessage() {} func (*SummaryDataPoint_ValueAtPercentile) Descriptor() ([]byte, []int) { - return fileDescriptorMetrics, []int{7, 0} + return fileDescriptor_3c3112f9fa006917, []int{7, 0} } +func (m *SummaryDataPoint_ValueAtPercentile) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SummaryDataPoint_ValueAtPercentile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SummaryDataPoint_ValueAtPercentile) XXX_Merge(src proto.Message) { + xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Merge(m, src) +} +func (m *SummaryDataPoint_ValueAtPercentile) XXX_Size() int { + return m.Size() +} +func (m *SummaryDataPoint_ValueAtPercentile) XXX_DiscardUnknown() { + xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.DiscardUnknown(m) +} + +var xxx_messageInfo_SummaryDataPoint_ValueAtPercentile proto.InternalMessageInfo func (m *SummaryDataPoint_ValueAtPercentile) GetPercentile() float64 { if m != nil { @@ -810,6 +1101,8 @@ func (m *SummaryDataPoint_ValueAtPercentile) GetValue() float64 { } func init() { + proto.RegisterEnum("opentelemetry.proto.metrics.v1.MetricDescriptor_Type", MetricDescriptor_Type_name, MetricDescriptor_Type_value) + proto.RegisterEnum("opentelemetry.proto.metrics.v1.MetricDescriptor_Temporality", MetricDescriptor_Temporality_name, MetricDescriptor_Temporality_value) proto.RegisterType((*ResourceMetrics)(nil), "opentelemetry.proto.metrics.v1.ResourceMetrics") proto.RegisterType((*InstrumentationLibraryMetrics)(nil), "opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics") proto.RegisterType((*Metric)(nil), "opentelemetry.proto.metrics.v1.Metric") @@ -821,13 +1114,86 @@ func init() { proto.RegisterType((*HistogramDataPoint_Bucket_Exemplar)(nil), "opentelemetry.proto.metrics.v1.HistogramDataPoint.Bucket.Exemplar") proto.RegisterType((*SummaryDataPoint)(nil), "opentelemetry.proto.metrics.v1.SummaryDataPoint") proto.RegisterType((*SummaryDataPoint_ValueAtPercentile)(nil), "opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtPercentile") - proto.RegisterEnum("opentelemetry.proto.metrics.v1.MetricDescriptor_Type", MetricDescriptor_Type_name, MetricDescriptor_Type_value) - proto.RegisterEnum("opentelemetry.proto.metrics.v1.MetricDescriptor_Temporality", MetricDescriptor_Temporality_name, MetricDescriptor_Temporality_value) } + +func init() { + proto.RegisterFile("opentelemetry/proto/metrics/v1/metrics.proto", fileDescriptor_3c3112f9fa006917) +} + +var fileDescriptor_3c3112f9fa006917 = []byte{ + // 1051 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0xef, 0xc4, 0x69, 0xba, 0x7d, 0xe9, 0xb6, 0xce, 0xb4, 0xb0, 0x51, 0xa5, 0x0d, 0x25, 0x42, + 0x50, 0x10, 0x75, 0x68, 0x29, 0x95, 0x90, 0x40, 0x22, 0xd9, 0x44, 0x6c, 0x44, 0xfe, 0x69, 0xe2, + 0x54, 0xea, 0x4a, 0xbb, 0xc6, 0x49, 0x87, 0x76, 0x84, 0x3d, 0x8e, 0xec, 0x71, 0xd5, 0x7c, 0x00, + 0xee, 0x1c, 0x90, 0x40, 0xe2, 0xeb, 0x80, 0xc4, 0x71, 0x39, 0x20, 0x71, 0x5c, 0xb5, 0x57, 0x6e, + 0x7c, 0x01, 0xe4, 0xb1, 0x9d, 0x38, 0x69, 0xda, 0x50, 0x4e, 0xc0, 0xed, 0xf9, 0x37, 0xef, 0xfd, + 0xde, 0xef, 0xbd, 0x79, 0x93, 0x99, 0xc0, 0xfb, 0xce, 0x90, 0x72, 0x41, 0x2d, 0x6a, 0x53, 0xe1, + 0x8e, 0x4a, 0x43, 0xd7, 0x11, 0x4e, 0x29, 0xb0, 0xd9, 0xc0, 0x2b, 0x5d, 0xec, 0xc7, 0xa6, 0x26, + 0x17, 0x70, 0x61, 0xca, 0x3b, 0x04, 0xb5, 0xd8, 0xe5, 0x62, 0x7f, 0xfb, 0xbd, 0x79, 0x6c, 0x03, + 0xc7, 0xb6, 0x1d, 0x1e, 0x90, 0x85, 0x56, 0x18, 0xb6, 0xad, 0xcd, 0xf3, 0x75, 0xa9, 0xe7, 0xf8, + 0xee, 0x80, 0x06, 0xde, 0xb1, 0x1d, 0xfa, 0x17, 0x5f, 0x21, 0xd8, 0x20, 0x11, 0xd4, 0x0c, 0x53, + 0xe2, 0x1a, 0x3c, 0x88, 0xbd, 0xf2, 0x68, 0x07, 0xed, 0x66, 0x0f, 0xde, 0xd5, 0xe6, 0x49, 0x1c, + 0x53, 0x5d, 0xec, 0x6b, 0x31, 0x07, 0x19, 0x87, 0xe2, 0x6f, 0x10, 0xbc, 0xc1, 0xb8, 0x27, 0x5c, + 0xdf, 0xa6, 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 0xa2, 0xb7, 0x5d, 0x87, 0xdc, 0x0d, 0x37, + 0x5c, 0x00, 0x98, 0x38, 0x46, 0x5b, 0x9e, 0x40, 0x26, 0xd3, 0x90, 0x4a, 0x4c, 0x43, 0xe5, 0x47, + 0xf4, 0xcb, 0x55, 0x01, 0xbd, 0xbc, 0x2a, 0xa0, 0x57, 0x57, 0x05, 0xf4, 0xed, 0x75, 0x61, 0xe9, + 0xe5, 0x75, 0x61, 0xe9, 0xf7, 0xeb, 0xc2, 0x12, 0xbc, 0xc9, 0x9c, 0x05, 0xea, 0x2b, 0x6b, 0xd1, + 0xdb, 0xb2, 0x13, 0x2c, 0x74, 0xd0, 0xb3, 0xd6, 0xd9, 0x6c, 0x08, 0x0b, 0xde, 0xf0, 0x96, 0x45, + 0x07, 0xc2, 0x71, 0x4b, 0x8c, 0x0b, 0xea, 0x72, 0xd3, 0x2a, 0x05, 0x0f, 0x88, 0xd2, 0x94, 0xe3, + 0x9e, 0xe4, 0xde, 0x3b, 0xa3, 0x3c, 0xf1, 0x0f, 0xa2, 0x9f, 0x91, 0xe8, 0x87, 0x7f, 0x05, 0x00, + 0x00, 0xff, 0xff, 0x4b, 0xd5, 0x42, 0x88, 0x6a, 0x0c, 0x00, 0x00, +} + func (m *ResourceMetrics) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -835,39 +1201,48 @@ func (m *ResourceMetrics) Marshal() (dAtA []byte, err error) { } func (m *ResourceMetrics) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Resource != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Resource.Size())) - n1, err := m.Resource.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } if len(m.InstrumentationLibraryMetrics) > 0 { - for _, msg := range m.InstrumentationLibraryMetrics { + for iNdEx := len(m.InstrumentationLibraryMetrics) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InstrumentationLibraryMetrics[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Resource != nil { + { + size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *InstrumentationLibraryMetrics) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -875,39 +1250,48 @@ func (m *InstrumentationLibraryMetrics) Marshal() (dAtA []byte, err error) { } func (m *InstrumentationLibraryMetrics) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InstrumentationLibraryMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.InstrumentationLibrary != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.InstrumentationLibrary.Size())) - n2, err := m.InstrumentationLibrary.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } if len(m.Metrics) > 0 { - for _, msg := range m.Metrics { + for iNdEx := len(m.Metrics) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Metrics[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.InstrumentationLibrary != nil { + { + size, err := m.InstrumentationLibrary.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Metric) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -915,75 +1299,90 @@ func (m *Metric) Marshal() (dAtA []byte, err error) { } func (m *Metric) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Metric) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.MetricDescriptor != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.MetricDescriptor.Size())) - n3, err := m.MetricDescriptor.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.SummaryDataPoints) > 0 { + for iNdEx := len(m.SummaryDataPoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SummaryDataPoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - i += n3 } - if len(m.Int64DataPoints) > 0 { - for _, msg := range m.Int64DataPoints { - dAtA[i] = 0x12 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.HistogramDataPoints) > 0 { + for iNdEx := len(m.HistogramDataPoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.HistogramDataPoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x22 } } if len(m.DoubleDataPoints) > 0 { - for _, msg := range m.DoubleDataPoints { - dAtA[i] = 0x1a - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.DoubleDataPoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DoubleDataPoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } - if len(m.HistogramDataPoints) > 0 { - for _, msg := range m.HistogramDataPoints { - dAtA[i] = 0x22 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Int64DataPoints) > 0 { + for iNdEx := len(m.Int64DataPoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Int64DataPoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if len(m.SummaryDataPoints) > 0 { - for _, msg := range m.SummaryDataPoints { - dAtA[i] = 0x2a - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.MetricDescriptor != nil { + { + size, err := m.MetricDescriptor.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *MetricDescriptor) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -991,45 +1390,53 @@ func (m *MetricDescriptor) Marshal() (dAtA []byte, err error) { } func (m *MetricDescriptor) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetricDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.Temporality != 0 { + i = encodeVarintMetrics(dAtA, i, uint64(m.Temporality)) + i-- + dAtA[i] = 0x28 } - if len(m.Description) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(len(m.Description))) - i += copy(dAtA[i:], m.Description) + if m.Type != 0 { + i = encodeVarintMetrics(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x20 } if len(m.Unit) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Unit) + copy(dAtA[i:], m.Unit) i = encodeVarintMetrics(dAtA, i, uint64(len(m.Unit))) - i += copy(dAtA[i:], m.Unit) + i-- + dAtA[i] = 0x1a } - if m.Type != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Type)) + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintMetrics(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 } - if m.Temporality != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Temporality)) + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintMetrics(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Int64DataPoint) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1037,44 +1444,53 @@ func (m *Int64DataPoint) Marshal() (dAtA []byte, err error) { } func (m *Int64DataPoint) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Int64DataPoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.StartTimeUnixNano != 0 { - dAtA[i] = 0x11 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.StartTimeUnixNano)) + if m.Value != 0 { + i = encodeVarintMetrics(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x20 } if m.TimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.TimeUnixNano)) + i-- dAtA[i] = 0x19 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.TimeUnixNano)) } - if m.Value != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Value)) + if m.StartTimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.StartTimeUnixNano)) + i-- + dAtA[i] = 0x11 } - return i, nil + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Labels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } func (m *DoubleDataPoint) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1082,44 +1498,54 @@ func (m *DoubleDataPoint) Marshal() (dAtA []byte, err error) { } func (m *DoubleDataPoint) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DoubleDataPoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.StartTimeUnixNano != 0 { - dAtA[i] = 0x11 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.StartTimeUnixNano)) + if m.Value != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i-- + dAtA[i] = 0x21 } if m.TimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.TimeUnixNano)) + i-- dAtA[i] = 0x19 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.TimeUnixNano)) } - if m.Value != 0 { - dAtA[i] = 0x21 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(math.Float64bits(float64(m.Value)))) + if m.StartTimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.StartTimeUnixNano)) + i-- + dAtA[i] = 0x11 + } + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Labels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return i, nil + return len(dAtA) - i, nil } func (m *HistogramDataPoint) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1127,85 +1553,83 @@ func (m *HistogramDataPoint) Marshal() (dAtA []byte, err error) { } func (m *HistogramDataPoint) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistogramDataPoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + if len(m.ExplicitBounds) > 0 { + for iNdEx := len(m.ExplicitBounds) - 1; iNdEx >= 0; iNdEx-- { + f4 := math.Float64bits(float64(m.ExplicitBounds[iNdEx])) + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(f4)) } + i = encodeVarintMetrics(dAtA, i, uint64(len(m.ExplicitBounds)*8)) + i-- + dAtA[i] = 0x3a } - if m.StartTimeUnixNano != 0 { - dAtA[i] = 0x11 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.StartTimeUnixNano)) + if len(m.Buckets) > 0 { + for iNdEx := len(m.Buckets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Buckets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } } - if m.TimeUnixNano != 0 { - dAtA[i] = 0x19 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.TimeUnixNano)) + if m.Sum != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Sum)))) + i-- + dAtA[i] = 0x29 } if m.Count != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintMetrics(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x20 } - if m.Sum != 0 { - dAtA[i] = 0x29 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(math.Float64bits(float64(m.Sum)))) + if m.TimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.TimeUnixNano)) + i-- + dAtA[i] = 0x19 } - if len(m.Buckets) > 0 { - for _, msg := range m.Buckets { - dAtA[i] = 0x32 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.StartTimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.StartTimeUnixNano)) + i-- + dAtA[i] = 0x11 + } + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Labels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - if len(m.ExplicitBounds) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintMetrics(dAtA, i, uint64(len(m.ExplicitBounds)*8)) - for _, num := range m.ExplicitBounds { - f4 := math.Float64bits(float64(num)) - dAtA[i] = uint8(f4) - i++ - dAtA[i] = uint8(f4 >> 8) - i++ - dAtA[i] = uint8(f4 >> 16) - i++ - dAtA[i] = uint8(f4 >> 24) - i++ - dAtA[i] = uint8(f4 >> 32) - i++ - dAtA[i] = uint8(f4 >> 40) - i++ - dAtA[i] = uint8(f4 >> 48) - i++ - dAtA[i] = uint8(f4 >> 56) - i++ - } - } - return i, nil + return len(dAtA) - i, nil } func (m *HistogramDataPoint_Bucket) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1213,32 +1637,39 @@ func (m *HistogramDataPoint_Bucket) Marshal() (dAtA []byte, err error) { } func (m *HistogramDataPoint_Bucket) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistogramDataPoint_Bucket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Count != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Count)) - } if m.Exemplar != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Exemplar.Size())) - n5, err := m.Exemplar.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Exemplar.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0x12 + } + if m.Count != 0 { + i = encodeVarintMetrics(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *HistogramDataPoint_Bucket_Exemplar) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1246,39 +1677,48 @@ func (m *HistogramDataPoint_Bucket_Exemplar) Marshal() (dAtA []byte, err error) } func (m *HistogramDataPoint_Bucket_Exemplar) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistogramDataPoint_Bucket_Exemplar) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Value != 0 { - dAtA[i] = 0x9 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(math.Float64bits(float64(m.Value)))) + if len(m.Attachments) > 0 { + for iNdEx := len(m.Attachments) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attachments[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } if m.TimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.TimeUnixNano)) + i-- dAtA[i] = 0x11 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.TimeUnixNano)) } - if len(m.Attachments) > 0 { - for _, msg := range m.Attachments { - dAtA[i] = 0x1a - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if m.Value != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i-- + dAtA[i] = 0x9 } - return i, nil + return len(dAtA) - i, nil } func (m *SummaryDataPoint) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1286,61 +1726,73 @@ func (m *SummaryDataPoint) Marshal() (dAtA []byte, err error) { } func (m *SummaryDataPoint) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SummaryDataPoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Labels) > 0 { - for _, msg := range m.Labels { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.PercentileValues) > 0 { + for iNdEx := len(m.PercentileValues) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PercentileValues[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x32 } } - if m.StartTimeUnixNano != 0 { - dAtA[i] = 0x11 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.StartTimeUnixNano)) - } - if m.TimeUnixNano != 0 { - dAtA[i] = 0x19 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(m.TimeUnixNano)) + if m.Sum != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Sum)))) + i-- + dAtA[i] = 0x29 } if m.Count != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintMetrics(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x20 } - if m.Sum != 0 { - dAtA[i] = 0x29 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(math.Float64bits(float64(m.Sum)))) + if m.TimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.TimeUnixNano)) + i-- + dAtA[i] = 0x19 } - if len(m.PercentileValues) > 0 { - for _, msg := range m.PercentileValues { - dAtA[i] = 0x32 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.StartTimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.StartTimeUnixNano)) + i-- + dAtA[i] = 0x11 + } + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Labels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetrics(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *SummaryDataPoint_ValueAtPercentile) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -1348,51 +1800,45 @@ func (m *SummaryDataPoint_ValueAtPercentile) Marshal() (dAtA []byte, err error) } func (m *SummaryDataPoint_ValueAtPercentile) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SummaryDataPoint_ValueAtPercentile) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Percentile != 0 { - dAtA[i] = 0x9 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(math.Float64bits(float64(m.Percentile)))) - } if m.Value != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i-- dAtA[i] = 0x11 - i++ - i = encodeFixed64Metrics(dAtA, i, uint64(math.Float64bits(float64(m.Value)))) } - return i, nil + if m.Percentile != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Percentile)))) + i-- + dAtA[i] = 0x9 + } + return len(dAtA) - i, nil } -func encodeFixed64Metrics(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Metrics(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int { + offset -= sovMetrics(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ResourceMetrics) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Resource != nil { @@ -1409,6 +1855,9 @@ func (m *ResourceMetrics) Size() (n int) { } func (m *InstrumentationLibraryMetrics) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.InstrumentationLibrary != nil { @@ -1425,6 +1874,9 @@ func (m *InstrumentationLibraryMetrics) Size() (n int) { } func (m *Metric) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.MetricDescriptor != nil { @@ -1459,6 +1911,9 @@ func (m *Metric) Size() (n int) { } func (m *MetricDescriptor) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -1483,6 +1938,9 @@ func (m *MetricDescriptor) Size() (n int) { } func (m *Int64DataPoint) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.Labels) > 0 { @@ -1504,6 +1962,9 @@ func (m *Int64DataPoint) Size() (n int) { } func (m *DoubleDataPoint) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.Labels) > 0 { @@ -1525,6 +1986,9 @@ func (m *DoubleDataPoint) Size() (n int) { } func (m *HistogramDataPoint) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.Labels) > 0 { @@ -1558,6 +2022,9 @@ func (m *HistogramDataPoint) Size() (n int) { } func (m *HistogramDataPoint_Bucket) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Count != 0 { @@ -1571,6 +2038,9 @@ func (m *HistogramDataPoint_Bucket) Size() (n int) { } func (m *HistogramDataPoint_Bucket_Exemplar) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Value != 0 { @@ -1589,6 +2059,9 @@ func (m *HistogramDataPoint_Bucket_Exemplar) Size() (n int) { } func (m *SummaryDataPoint) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.Labels) > 0 { @@ -1619,6 +2092,9 @@ func (m *SummaryDataPoint) Size() (n int) { } func (m *SummaryDataPoint_ValueAtPercentile) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Percentile != 0 { @@ -1631,14 +2107,7 @@ func (m *SummaryDataPoint_ValueAtPercentile) Size() (n int) { } func sovMetrics(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozMetrics(x uint64) (n int) { return sovMetrics(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -1658,7 +2127,7 @@ func (m *ResourceMetrics) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1686,7 +2155,7 @@ func (m *ResourceMetrics) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1695,11 +2164,14 @@ func (m *ResourceMetrics) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } if m.Resource == nil { - m.Resource = &opentelemetry_proto_resource_v1.Resource{} + m.Resource = &v1.Resource{} } if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1719,7 +2191,7 @@ func (m *ResourceMetrics) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1728,6 +2200,9 @@ func (m *ResourceMetrics) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1745,6 +2220,9 @@ func (m *ResourceMetrics) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1772,7 +2250,7 @@ func (m *InstrumentationLibraryMetrics) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1800,7 +2278,7 @@ func (m *InstrumentationLibraryMetrics) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1809,11 +2287,14 @@ func (m *InstrumentationLibraryMetrics) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } if m.InstrumentationLibrary == nil { - m.InstrumentationLibrary = &opentelemetry_proto_common_v1.InstrumentationLibrary{} + m.InstrumentationLibrary = &v11.InstrumentationLibrary{} } if err := m.InstrumentationLibrary.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1833,7 +2314,7 @@ func (m *InstrumentationLibraryMetrics) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1842,6 +2323,9 @@ func (m *InstrumentationLibraryMetrics) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1859,6 +2343,9 @@ func (m *InstrumentationLibraryMetrics) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1886,7 +2373,7 @@ func (m *Metric) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1914,7 +2401,7 @@ func (m *Metric) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1923,6 +2410,9 @@ func (m *Metric) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1947,7 +2437,7 @@ func (m *Metric) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1956,6 +2446,9 @@ func (m *Metric) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1978,7 +2471,7 @@ func (m *Metric) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1987,6 +2480,9 @@ func (m *Metric) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2009,7 +2505,7 @@ func (m *Metric) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2018,6 +2514,9 @@ func (m *Metric) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2040,7 +2539,7 @@ func (m *Metric) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2049,6 +2548,9 @@ func (m *Metric) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2066,6 +2568,9 @@ func (m *Metric) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2093,7 +2598,7 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2121,7 +2626,7 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2131,6 +2636,9 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2150,7 +2658,7 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2160,6 +2668,9 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2179,7 +2690,7 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2189,6 +2700,9 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2208,7 +2722,7 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (MetricDescriptor_Type(b) & 0x7F) << shift + m.Type |= MetricDescriptor_Type(b&0x7F) << shift if b < 0x80 { break } @@ -2227,7 +2741,7 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Temporality |= (MetricDescriptor_Temporality(b) & 0x7F) << shift + m.Temporality |= MetricDescriptor_Temporality(b&0x7F) << shift if b < 0x80 { break } @@ -2241,6 +2755,9 @@ func (m *MetricDescriptor) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2268,7 +2785,7 @@ func (m *Int64DataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2296,7 +2813,7 @@ func (m *Int64DataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2305,10 +2822,13 @@ func (m *Int64DataPoint) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Labels = append(m.Labels, &opentelemetry_proto_common_v1.StringKeyValue{}) + m.Labels = append(m.Labels, &v11.StringKeyValue{}) if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2321,15 +2841,8 @@ func (m *Int64DataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.StartTimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.StartTimeUnixNano = uint64(dAtA[iNdEx-8]) - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 3: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field TimeUnixNano", wireType) @@ -2338,15 +2851,8 @@ func (m *Int64DataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.TimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.TimeUnixNano = uint64(dAtA[iNdEx-8]) - m.TimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.TimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.TimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.TimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.TimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.TimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.TimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) @@ -2361,7 +2867,7 @@ func (m *Int64DataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Value |= (int64(b) & 0x7F) << shift + m.Value |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -2375,6 +2881,9 @@ func (m *Int64DataPoint) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2402,7 +2911,7 @@ func (m *DoubleDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2430,7 +2939,7 @@ func (m *DoubleDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2439,10 +2948,13 @@ func (m *DoubleDataPoint) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Labels = append(m.Labels, &opentelemetry_proto_common_v1.StringKeyValue{}) + m.Labels = append(m.Labels, &v11.StringKeyValue{}) if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2455,15 +2967,8 @@ func (m *DoubleDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.StartTimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.StartTimeUnixNano = uint64(dAtA[iNdEx-8]) - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 3: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field TimeUnixNano", wireType) @@ -2472,15 +2977,8 @@ func (m *DoubleDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.TimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.TimeUnixNano = uint64(dAtA[iNdEx-8]) - m.TimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.TimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.TimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.TimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.TimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.TimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.TimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 4: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) @@ -2489,15 +2987,8 @@ func (m *DoubleDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 m.Value = float64(math.Float64frombits(v)) default: iNdEx = preIndex @@ -2508,6 +2999,9 @@ func (m *DoubleDataPoint) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2535,7 +3029,7 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2563,7 +3057,7 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2572,10 +3066,13 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Labels = append(m.Labels, &opentelemetry_proto_common_v1.StringKeyValue{}) + m.Labels = append(m.Labels, &v11.StringKeyValue{}) if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2588,15 +3085,8 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.StartTimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.StartTimeUnixNano = uint64(dAtA[iNdEx-8]) - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 3: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field TimeUnixNano", wireType) @@ -2605,15 +3095,8 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.TimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.TimeUnixNano = uint64(dAtA[iNdEx-8]) - m.TimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.TimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.TimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.TimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.TimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.TimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.TimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) @@ -2628,7 +3111,7 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Count |= (uint64(b) & 0x7F) << shift + m.Count |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2641,15 +3124,8 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 m.Sum = float64(math.Float64frombits(v)) case 6: if wireType != 2 { @@ -2665,7 +3141,7 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2674,6 +3150,9 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2688,15 +3167,8 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.ExplicitBounds = append(m.ExplicitBounds, v2) } else if wireType == 2 { @@ -2710,7 +3182,7 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - packedLen |= (int(b) & 0x7F) << shift + packedLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2719,23 +3191,24 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.ExplicitBounds) == 0 { + m.ExplicitBounds = make([]float64, 0, elementCount) + } for iNdEx < postIndex { var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.ExplicitBounds = append(m.ExplicitBounds, v2) } @@ -2751,6 +3224,9 @@ func (m *HistogramDataPoint) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2778,7 +3254,7 @@ func (m *HistogramDataPoint_Bucket) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2806,7 +3282,7 @@ func (m *HistogramDataPoint_Bucket) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Count |= (uint64(b) & 0x7F) << shift + m.Count |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2825,7 +3301,7 @@ func (m *HistogramDataPoint_Bucket) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2834,6 +3310,9 @@ func (m *HistogramDataPoint_Bucket) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2853,6 +3332,9 @@ func (m *HistogramDataPoint_Bucket) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2880,7 +3362,7 @@ func (m *HistogramDataPoint_Bucket_Exemplar) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2902,15 +3384,8 @@ func (m *HistogramDataPoint_Bucket_Exemplar) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 m.Value = float64(math.Float64frombits(v)) case 2: if wireType != 1 { @@ -2920,15 +3395,8 @@ func (m *HistogramDataPoint_Bucket_Exemplar) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.TimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.TimeUnixNano = uint64(dAtA[iNdEx-8]) - m.TimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.TimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.TimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.TimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.TimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.TimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.TimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attachments", wireType) @@ -2943,7 +3411,7 @@ func (m *HistogramDataPoint_Bucket_Exemplar) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2952,10 +3420,13 @@ func (m *HistogramDataPoint_Bucket_Exemplar) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Attachments = append(m.Attachments, &opentelemetry_proto_common_v1.StringKeyValue{}) + m.Attachments = append(m.Attachments, &v11.StringKeyValue{}) if err := m.Attachments[len(m.Attachments)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2969,6 +3440,9 @@ func (m *HistogramDataPoint_Bucket_Exemplar) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2996,7 +3470,7 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -3024,7 +3498,7 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -3033,10 +3507,13 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Labels = append(m.Labels, &opentelemetry_proto_common_v1.StringKeyValue{}) + m.Labels = append(m.Labels, &v11.StringKeyValue{}) if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3049,15 +3526,8 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.StartTimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.StartTimeUnixNano = uint64(dAtA[iNdEx-8]) - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 3: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field TimeUnixNano", wireType) @@ -3066,15 +3536,8 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.TimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.TimeUnixNano = uint64(dAtA[iNdEx-8]) - m.TimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.TimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.TimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.TimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.TimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.TimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.TimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) @@ -3089,7 +3552,7 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Count |= (uint64(b) & 0x7F) << shift + m.Count |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -3102,15 +3565,8 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 m.Sum = float64(math.Float64frombits(v)) case 6: if wireType != 2 { @@ -3126,7 +3582,7 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -3135,6 +3591,9 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMetrics } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -3152,6 +3611,9 @@ func (m *SummaryDataPoint) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -3179,7 +3641,7 @@ func (m *SummaryDataPoint_ValueAtPercentile) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -3201,15 +3663,8 @@ func (m *SummaryDataPoint_ValueAtPercentile) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 m.Percentile = float64(math.Float64frombits(v)) case 2: if wireType != 1 { @@ -3219,15 +3674,8 @@ func (m *SummaryDataPoint_ValueAtPercentile) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 m.Value = float64(math.Float64frombits(v)) default: iNdEx = preIndex @@ -3238,6 +3686,9 @@ func (m *SummaryDataPoint_ValueAtPercentile) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMetrics } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -3253,6 +3704,7 @@ func (m *SummaryDataPoint_ValueAtPercentile) Unmarshal(dAtA []byte) error { func skipMetrics(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -3284,10 +3736,8 @@ func skipMetrics(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -3304,125 +3754,34 @@ func skipMetrics(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthMetrics } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMetrics - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipMetrics(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMetrics + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthMetrics + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMetrics = fmt.Errorf("proto: unexpected end of group") ) - -func init() { proto.RegisterFile("opentelemetry/proto/metrics/v1/metrics.proto", fileDescriptorMetrics) } - -var fileDescriptorMetrics = []byte{ - // 1042 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xdf, 0x6e, 0xe3, 0xc4, - 0x17, 0xde, 0x89, 0xd3, 0x74, 0x7b, 0xd2, 0x6d, 0x9d, 0x69, 0x7f, 0xbf, 0x8d, 0x2a, 0x6d, 0x28, - 0x11, 0x82, 0x82, 0xa8, 0x43, 0x4b, 0xa9, 0x84, 0x04, 0x12, 0xc9, 0x26, 0x62, 0x2d, 0xf2, 0x4f, - 0x13, 0xa7, 0x52, 0x57, 0xda, 0x35, 0x4e, 0x3a, 0xb4, 0x23, 0xec, 0x71, 0x64, 0x8f, 0xab, 0xe6, - 0x01, 0xb8, 0x47, 0x02, 0x09, 0x1e, 0x08, 0x24, 0x2e, 0xe1, 0x82, 0xfb, 0x55, 0xb9, 0xe5, 0x8e, - 0x17, 0x40, 0x1e, 0xdb, 0x89, 0x93, 0xa6, 0x0d, 0xe5, 0x0a, 0xb8, 0x3b, 0xfe, 0xe6, 0x9c, 0xef, - 0x7c, 0xe7, 0xcc, 0x99, 0xcc, 0x04, 0xde, 0x75, 0x47, 0x94, 0x0b, 0x6a, 0x53, 0x87, 0x0a, 0x6f, - 0x5c, 0x19, 0x79, 0xae, 0x70, 0x2b, 0xa1, 0xcd, 0x86, 0x7e, 0xe5, 0xf2, 0x20, 0x31, 0x35, 0xb9, - 0x80, 0x4b, 0x33, 0xde, 0x11, 0xa8, 0x25, 0x2e, 0x97, 0x07, 0x3b, 0xef, 0x2c, 0x62, 0x1b, 0xba, - 0x8e, 0xe3, 0xf2, 0x90, 0x2c, 0xb2, 0xa2, 0xb0, 0x1d, 0x6d, 0x91, 0xaf, 0x47, 0x7d, 0x37, 0xf0, -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 0x75, 0xcf, 0x91, 0x48, 0x33, - 0x94, 0xbf, 0x55, 0x40, 0x9d, 0xbf, 0x04, 0xfe, 0x23, 0x33, 0xe7, 0x42, 0x61, 0x44, 0xbd, 0x21, - 0xe5, 0x82, 0xd9, 0xd4, 0x94, 0x5d, 0x4e, 0xa6, 0xaf, 0x76, 0xdf, 0x7b, 0x51, 0x93, 0x95, 0x55, - 0x45, 0x77, 0x42, 0x48, 0xd4, 0x29, 0xb9, 0x5c, 0xf4, 0x77, 0x74, 0x28, 0xdc, 0x70, 0xc3, 0x25, - 0x80, 0xa9, 0x63, 0xbc, 0xe5, 0x29, 0x64, 0x3a, 0x0d, 0x99, 0xd4, 0x34, 0xd4, 0xbe, 0x41, 0x3f, - 0x5d, 0x97, 0xd0, 0xcf, 0xd7, 0x25, 0xf4, 0xea, 0xba, 0x84, 0xbe, 0xfe, 0xad, 0xf4, 0x00, 0x5e, - 0x67, 0xee, 0x12, 0xd5, 0xb5, 0xf5, 0xf8, 0x4d, 0xd9, 0x0d, 0x17, 0xba, 0xe8, 0x79, 0xfb, 0x7c, - 0x3e, 0x84, 0x85, 0x6f, 0x77, 0xdb, 0xa6, 0x43, 0xe1, 0x7a, 0x15, 0xc6, 0x05, 0xf5, 0xb8, 0x65, - 0x57, 0xc2, 0x87, 0x43, 0x65, 0xc6, 0x71, 0x5f, 0x72, 0xef, 0x9f, 0x53, 0x9e, 0xfa, 0xe7, 0x30, - 0xc8, 0x49, 0xf4, 0xfd, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xef, 0x70, 0x68, 0x62, 0x0c, - 0x00, 0x00, -} diff --git a/internal/data/opentelemetry-proto-gen/resource/v1/resource.pb.go b/internal/data/opentelemetry-proto-gen/resource/v1/resource.pb.go index 32c02652b832..281c5b999c4e 100644 --- a/internal/data/opentelemetry-proto-gen/resource/v1/resource.pb.go +++ b/internal/data/opentelemetry-proto-gen/resource/v1/resource.pb.go @@ -1,23 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: opentelemetry/proto/resource/v1/resource.proto -/* - Package v1 is a generated protocol buffer package. - - It is generated from these files: - opentelemetry/proto/resource/v1/resource.proto - - It has these top-level messages: - Resource -*/ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import opentelemetry_proto_common_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" - -import io "io" +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -28,23 +21,51 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Resource information. type Resource struct { // Set of labels that describe the resource. - Attributes []*opentelemetry_proto_common_v1.AttributeKeyValue `protobuf:"bytes,1,rep,name=attributes" json:"attributes,omitempty"` + Attributes []*v1.KeyValue `protobuf:"bytes,1,rep,name=attributes,proto3" json:"attributes,omitempty"` // dropped_attributes_count is the number of dropped attributes. If the value is 0, then // no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,2,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` } -func (m *Resource) Reset() { *m = Resource{} } -func (m *Resource) String() string { return proto.CompactTextString(m) } -func (*Resource) ProtoMessage() {} -func (*Resource) Descriptor() ([]byte, []int) { return fileDescriptorResource, []int{0} } +func (m *Resource) Reset() { *m = Resource{} } +func (m *Resource) String() string { return proto.CompactTextString(m) } +func (*Resource) ProtoMessage() {} +func (*Resource) Descriptor() ([]byte, []int) { + return fileDescriptor_446f73eacf88f3f5, []int{0} +} +func (m *Resource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Resource.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Resource) XXX_Merge(src proto.Message) { + xxx_messageInfo_Resource.Merge(m, src) +} +func (m *Resource) XXX_Size() int { + return m.Size() +} +func (m *Resource) XXX_DiscardUnknown() { + xxx_messageInfo_Resource.DiscardUnknown(m) +} + +var xxx_messageInfo_Resource proto.InternalMessageInfo -func (m *Resource) GetAttributes() []*opentelemetry_proto_common_v1.AttributeKeyValue { +func (m *Resource) GetAttributes() []*v1.KeyValue { if m != nil { return m.Attributes } @@ -61,10 +82,36 @@ func (m *Resource) GetDroppedAttributesCount() uint32 { func init() { proto.RegisterType((*Resource)(nil), "opentelemetry.proto.resource.v1.Resource") } + +func init() { + proto.RegisterFile("opentelemetry/proto/resource/v1/resource.proto", fileDescriptor_446f73eacf88f3f5) +} + +var fileDescriptor_446f73eacf88f3f5 = []byte{ + // 266 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcb, 0x2f, 0x48, 0xcd, + 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, + 0x2f, 0x4a, 0x2d, 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2f, 0x33, 0x84, 0xb3, 0xf5, 0xc0, 0x52, + 0x42, 0xf2, 0x28, 0xea, 0x21, 0x82, 0x7a, 0x70, 0x35, 0x65, 0x86, 0x52, 0x5a, 0xd8, 0x0c, 0x4c, + 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0x03, 0x19, 0x07, 0x61, 0x41, 0xf4, 0x29, 0xf5, 0x32, 0x72, 0x71, + 0x04, 0x41, 0xf5, 0x0a, 0xb9, 0x73, 0x71, 0x25, 0x96, 0x94, 0x14, 0x65, 0x26, 0x95, 0x96, 0xa4, + 0x16, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b, 0xa9, 0xeb, 0x61, 0xb3, 0x0e, 0x6a, 0x46, 0x99, + 0xa1, 0x9e, 0x77, 0x6a, 0x65, 0x58, 0x62, 0x4e, 0x69, 0x6a, 0x10, 0x92, 0x56, 0x21, 0x0b, 0x2e, + 0x89, 0x94, 0xa2, 0xfc, 0x82, 0x82, 0xd4, 0x94, 0x78, 0x84, 0x68, 0x7c, 0x72, 0x7e, 0x69, 0x5e, + 0x89, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6f, 0x90, 0x18, 0x54, 0xde, 0x11, 0x2e, 0xed, 0x0c, 0x92, + 0x75, 0x9a, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, + 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x5c, 0x4a, 0x99, + 0xf9, 0x7a, 0x04, 0xbc, 0xee, 0xc4, 0x0b, 0xf3, 0x4b, 0x00, 0x48, 0x2a, 0x80, 0x31, 0xca, 0x3f, + 0x1d, 0x5d, 0x53, 0x26, 0x28, 0x2c, 0x72, 0x72, 0x52, 0x93, 0x4b, 0xf2, 0x8b, 0xf4, 0x33, 0xf3, + 0x4a, 0x52, 0x8b, 0xf2, 0x12, 0x73, 0xf4, 0x53, 0x12, 0x4b, 0x12, 0xf5, 0x51, 0x14, 0xea, 0x82, + 0x4d, 0xd7, 0x4d, 0x4f, 0xcd, 0x43, 0x8e, 0x8c, 0x24, 0x36, 0xb0, 0xb0, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0x38, 0xcb, 0xc8, 0xa3, 0xb6, 0x01, 0x00, 0x00, +} + func (m *Resource) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -72,58 +119,52 @@ func (m *Resource) Marshal() (dAtA []byte, err error) { } func (m *Resource) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Resource) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.DroppedAttributesCount != 0 { + i = encodeVarintResource(dAtA, i, uint64(m.DroppedAttributesCount)) + i-- + dAtA[i] = 0x10 + } if len(m.Attributes) > 0 { - for _, msg := range m.Attributes { - dAtA[i] = 0xa - i++ - i = encodeVarintResource(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintResource(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - if m.DroppedAttributesCount != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintResource(dAtA, i, uint64(m.DroppedAttributesCount)) - } - return i, nil + return len(dAtA) - i, nil } -func encodeFixed64Resource(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Resource(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintResource(dAtA []byte, offset int, v uint64) int { + offset -= sovResource(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Resource) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.Attributes) > 0 { @@ -139,14 +180,7 @@ func (m *Resource) Size() (n int) { } func sovResource(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozResource(x uint64) (n int) { return sovResource(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -166,7 +200,7 @@ func (m *Resource) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -194,7 +228,7 @@ func (m *Resource) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -203,10 +237,13 @@ func (m *Resource) Unmarshal(dAtA []byte) error { return ErrInvalidLengthResource } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthResource + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Attributes = append(m.Attributes, &opentelemetry_proto_common_v1.AttributeKeyValue{}) + m.Attributes = append(m.Attributes, &v1.KeyValue{}) if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -225,7 +262,7 @@ func (m *Resource) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DroppedAttributesCount |= (uint32(b) & 0x7F) << shift + m.DroppedAttributesCount |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -239,6 +276,9 @@ func (m *Resource) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthResource } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthResource + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -254,6 +294,7 @@ func (m *Resource) Unmarshal(dAtA []byte) error { func skipResource(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -285,10 +326,8 @@ func skipResource(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -305,78 +344,34 @@ func skipResource(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthResource } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowResource - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipResource(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupResource + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthResource + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthResource = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowResource = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthResource = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowResource = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupResource = fmt.Errorf("proto: unexpected end of group") ) - -func init() { - proto.RegisterFile("opentelemetry/proto/resource/v1/resource.proto", fileDescriptorResource) -} - -var fileDescriptorResource = []byte{ - // 261 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcb, 0x2f, 0x48, 0xcd, - 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, - 0x2f, 0x4a, 0x2d, 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2f, 0x33, 0x84, 0xb3, 0xf5, 0xc0, 0x52, - 0x42, 0xf2, 0x28, 0xea, 0x21, 0x82, 0x7a, 0x70, 0x35, 0x65, 0x86, 0x52, 0x5a, 0xd8, 0x0c, 0x4c, - 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0x03, 0x19, 0x07, 0x61, 0x41, 0xf4, 0x29, 0x4d, 0x63, 0xe4, 0xe2, - 0x08, 0x82, 0xea, 0x15, 0x0a, 0xe0, 0xe2, 0x4a, 0x2c, 0x29, 0x29, 0xca, 0x4c, 0x2a, 0x2d, 0x49, - 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x32, 0xd0, 0xc3, 0x66, 0x1d, 0xd4, 0x8c, 0x32, - 0x43, 0x3d, 0x47, 0x98, 0x06, 0xef, 0xd4, 0xca, 0xb0, 0xc4, 0x9c, 0xd2, 0xd4, 0x20, 0x24, 0x33, - 0x84, 0x2c, 0xb8, 0x24, 0x52, 0x8a, 0xf2, 0x0b, 0x0a, 0x52, 0x53, 0xe2, 0x11, 0xa2, 0xf1, 0xc9, - 0xf9, 0xa5, 0x79, 0x25, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xbc, 0x41, 0x62, 0x50, 0x79, 0xb8, 0x39, - 0xc5, 0xce, 0x20, 0x59, 0xa7, 0x69, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, - 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x5c, 0x4a, 0x99, 0xf9, 0x7a, 0x04, 0xfc, 0xee, - 0xc4, 0x0b, 0xf3, 0x4c, 0x00, 0x48, 0x2a, 0x80, 0x31, 0xca, 0x3f, 0x1d, 0x5d, 0x53, 0x26, 0x28, - 0x30, 0x72, 0x72, 0x52, 0x93, 0x4b, 0xf2, 0x8b, 0xf4, 0x33, 0xf3, 0x4a, 0x52, 0x8b, 0xf2, 0x12, - 0x73, 0xf4, 0x53, 0x12, 0x4b, 0x12, 0xf5, 0x51, 0x14, 0xea, 0x82, 0x4d, 0xd7, 0x4d, 0x4f, 0xcd, - 0x43, 0x8e, 0x8d, 0x24, 0x36, 0xb0, 0xb0, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x08, 0xb6, 0x88, - 0x23, 0xb7, 0x01, 0x00, 0x00, -} diff --git a/internal/data/opentelemetry-proto-gen/trace/v1/trace.pb.go b/internal/data/opentelemetry-proto-gen/trace/v1/trace.pb.go index 41094429cd6b..b4928ac379bc 100644 --- a/internal/data/opentelemetry-proto-gen/trace/v1/trace.pb.go +++ b/internal/data/opentelemetry-proto-gen/trace/v1/trace.pb.go @@ -1,27 +1,18 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: opentelemetry/proto/trace/v1/trace.proto -/* - Package v1 is a generated protocol buffer package. - - It is generated from these files: - opentelemetry/proto/trace/v1/trace.proto - - It has these top-level messages: - ResourceSpans - InstrumentationLibrarySpans - Span - Status -*/ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import opentelemetry_proto_common_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" -import opentelemetry_proto_resource_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1" - -import io "io" +import ( + encoding_binary "encoding/binary" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + v11 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" + v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -32,7 +23,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // SpanKind is the type of span. Can be used to specify additional relationships between spans // in addition to a parent/child relationship. @@ -69,6 +60,7 @@ var Span_SpanKind_name = map[int32]string{ 4: "PRODUCER", 5: "CONSUMER", } + var Span_SpanKind_value = map[string]int32{ "SPAN_KIND_UNSPECIFIED": 0, "INTERNAL": 1, @@ -81,7 +73,10 @@ var Span_SpanKind_value = map[string]int32{ func (x Span_SpanKind) String() string { return proto.EnumName(Span_SpanKind_name, int32(x)) } -func (Span_SpanKind) EnumDescriptor() ([]byte, []int) { return fileDescriptorTrace, []int{2, 0} } + +func (Span_SpanKind) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{2, 0} +} // StatusCode mirrors the codes defined at // https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/api-tracing.md#statuscanonicalcode @@ -126,6 +121,7 @@ var Status_StatusCode_name = map[int32]string{ 15: "DataLoss", 16: "Unauthenticated", } + var Status_StatusCode_value = map[string]int32{ "Ok": 0, "Cancelled": 1, @@ -149,23 +145,54 @@ var Status_StatusCode_value = map[string]int32{ func (x Status_StatusCode) String() string { return proto.EnumName(Status_StatusCode_name, int32(x)) } -func (Status_StatusCode) EnumDescriptor() ([]byte, []int) { return fileDescriptorTrace, []int{3, 0} } + +func (Status_StatusCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{3, 0} +} // A collection of InstrumentationLibrarySpans from a Resource. type ResourceSpans struct { // The resource for the spans in this message. // If this field is not set then no resource info is known. - Resource *opentelemetry_proto_resource_v1.Resource `protobuf:"bytes,1,opt,name=resource" json:"resource,omitempty"` + Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` // A list of InstrumentationLibrarySpans that originate from a resource. - InstrumentationLibrarySpans []*InstrumentationLibrarySpans `protobuf:"bytes,2,rep,name=instrumentation_library_spans,json=instrumentationLibrarySpans" json:"instrumentation_library_spans,omitempty"` + InstrumentationLibrarySpans []*InstrumentationLibrarySpans `protobuf:"bytes,2,rep,name=instrumentation_library_spans,json=instrumentationLibrarySpans,proto3" json:"instrumentation_library_spans,omitempty"` +} + +func (m *ResourceSpans) Reset() { *m = ResourceSpans{} } +func (m *ResourceSpans) String() string { return proto.CompactTextString(m) } +func (*ResourceSpans) ProtoMessage() {} +func (*ResourceSpans) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{0} +} +func (m *ResourceSpans) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceSpans) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResourceSpans.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResourceSpans) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceSpans.Merge(m, src) +} +func (m *ResourceSpans) XXX_Size() int { + return m.Size() +} +func (m *ResourceSpans) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceSpans.DiscardUnknown(m) } -func (m *ResourceSpans) Reset() { *m = ResourceSpans{} } -func (m *ResourceSpans) String() string { return proto.CompactTextString(m) } -func (*ResourceSpans) ProtoMessage() {} -func (*ResourceSpans) Descriptor() ([]byte, []int) { return fileDescriptorTrace, []int{0} } +var xxx_messageInfo_ResourceSpans proto.InternalMessageInfo -func (m *ResourceSpans) GetResource() *opentelemetry_proto_resource_v1.Resource { +func (m *ResourceSpans) GetResource() *v1.Resource { if m != nil { return m.Resource } @@ -183,17 +210,45 @@ func (m *ResourceSpans) GetInstrumentationLibrarySpans() []*InstrumentationLibra type InstrumentationLibrarySpans struct { // The instrumentation library information for the spans in this message. // If this field is not set then no library info is known. - InstrumentationLibrary *opentelemetry_proto_common_v1.InstrumentationLibrary `protobuf:"bytes,1,opt,name=instrumentation_library,json=instrumentationLibrary" json:"instrumentation_library,omitempty"` + InstrumentationLibrary *v11.InstrumentationLibrary `protobuf:"bytes,1,opt,name=instrumentation_library,json=instrumentationLibrary,proto3" json:"instrumentation_library,omitempty"` // A list of Spans that originate from an instrumentation library. - Spans []*Span `protobuf:"bytes,2,rep,name=spans" json:"spans,omitempty"` + Spans []*Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"` +} + +func (m *InstrumentationLibrarySpans) Reset() { *m = InstrumentationLibrarySpans{} } +func (m *InstrumentationLibrarySpans) String() string { return proto.CompactTextString(m) } +func (*InstrumentationLibrarySpans) ProtoMessage() {} +func (*InstrumentationLibrarySpans) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{1} +} +func (m *InstrumentationLibrarySpans) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *InstrumentationLibrarySpans) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InstrumentationLibrarySpans.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *InstrumentationLibrarySpans) XXX_Merge(src proto.Message) { + xxx_messageInfo_InstrumentationLibrarySpans.Merge(m, src) +} +func (m *InstrumentationLibrarySpans) XXX_Size() int { + return m.Size() +} +func (m *InstrumentationLibrarySpans) XXX_DiscardUnknown() { + xxx_messageInfo_InstrumentationLibrarySpans.DiscardUnknown(m) } -func (m *InstrumentationLibrarySpans) Reset() { *m = InstrumentationLibrarySpans{} } -func (m *InstrumentationLibrarySpans) String() string { return proto.CompactTextString(m) } -func (*InstrumentationLibrarySpans) ProtoMessage() {} -func (*InstrumentationLibrarySpans) Descriptor() ([]byte, []int) { return fileDescriptorTrace, []int{1} } +var xxx_messageInfo_InstrumentationLibrarySpans proto.InternalMessageInfo -func (m *InstrumentationLibrarySpans) GetInstrumentationLibrary() *opentelemetry_proto_common_v1.InstrumentationLibrary { +func (m *InstrumentationLibrarySpans) GetInstrumentationLibrary() *v11.InstrumentationLibrary { if m != nil { return m.InstrumentationLibrary } @@ -282,32 +337,60 @@ type Span struct { // "/http/server_latency": 300 // "abc.com/myattribute": true // "abc.com/score": 10.239 - Attributes []*opentelemetry_proto_common_v1.AttributeKeyValue `protobuf:"bytes,9,rep,name=attributes" json:"attributes,omitempty"` + Attributes []*v11.KeyValue `protobuf:"bytes,9,rep,name=attributes,proto3" json:"attributes,omitempty"` // dropped_attributes_count is the number of attributes that were discarded. Attributes // can be discarded because their keys are too long or because there are too many // attributes. If this value is 0, then no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,10,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` // events is a collection of Event items. - Events []*Span_Event `protobuf:"bytes,11,rep,name=events" json:"events,omitempty"` + Events []*Span_Event `protobuf:"bytes,11,rep,name=events,proto3" json:"events,omitempty"` // dropped_events_count is the number of dropped events. If the value is 0, then no // events were dropped. DroppedEventsCount uint32 `protobuf:"varint,12,opt,name=dropped_events_count,json=droppedEventsCount,proto3" json:"dropped_events_count,omitempty"` // links is a collection of Links, which are references from this span to a span // in the same or different trace. - Links []*Span_Link `protobuf:"bytes,13,rep,name=links" json:"links,omitempty"` + Links []*Span_Link `protobuf:"bytes,13,rep,name=links,proto3" json:"links,omitempty"` // dropped_links_count is the number of dropped links after the maximum size was // enforced. If this value is 0, then no links were dropped. DroppedLinksCount uint32 `protobuf:"varint,14,opt,name=dropped_links_count,json=droppedLinksCount,proto3" json:"dropped_links_count,omitempty"` // An optional final status for this span. Semantically when Status // wasn't set it is means span ended without errors and assume // Status.Ok (code = 0). - Status *Status `protobuf:"bytes,15,opt,name=status" json:"status,omitempty"` + Status *Status `protobuf:"bytes,15,opt,name=status,proto3" json:"status,omitempty"` +} + +func (m *Span) Reset() { *m = Span{} } +func (m *Span) String() string { return proto.CompactTextString(m) } +func (*Span) ProtoMessage() {} +func (*Span) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{2} +} +func (m *Span) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Span) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Span.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Span) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span.Merge(m, src) +} +func (m *Span) XXX_Size() int { + return m.Size() +} +func (m *Span) XXX_DiscardUnknown() { + xxx_messageInfo_Span.DiscardUnknown(m) } -func (m *Span) Reset() { *m = Span{} } -func (m *Span) String() string { return proto.CompactTextString(m) } -func (*Span) ProtoMessage() {} -func (*Span) Descriptor() ([]byte, []int) { return fileDescriptorTrace, []int{2} } +var xxx_messageInfo_Span proto.InternalMessageInfo func (m *Span) GetTraceId() []byte { if m != nil { @@ -365,7 +448,7 @@ func (m *Span) GetEndTimeUnixNano() uint64 { return 0 } -func (m *Span) GetAttributes() []*opentelemetry_proto_common_v1.AttributeKeyValue { +func (m *Span) GetAttributes() []*v11.KeyValue { if m != nil { return m.Attributes } @@ -423,16 +506,44 @@ type Span_Event struct { // This field is semantically required to be set to non-empty string. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // attributes is a collection of attribute key/value pairs on the event. - Attributes []*opentelemetry_proto_common_v1.AttributeKeyValue `protobuf:"bytes,3,rep,name=attributes" json:"attributes,omitempty"` + Attributes []*v11.KeyValue `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` // dropped_attributes_count is the number of dropped attributes. If the value is 0, // then no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,4,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` } -func (m *Span_Event) Reset() { *m = Span_Event{} } -func (m *Span_Event) String() string { return proto.CompactTextString(m) } -func (*Span_Event) ProtoMessage() {} -func (*Span_Event) Descriptor() ([]byte, []int) { return fileDescriptorTrace, []int{2, 0} } +func (m *Span_Event) Reset() { *m = Span_Event{} } +func (m *Span_Event) String() string { return proto.CompactTextString(m) } +func (*Span_Event) ProtoMessage() {} +func (*Span_Event) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{2, 0} +} +func (m *Span_Event) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Span_Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Span_Event.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Span_Event) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Event.Merge(m, src) +} +func (m *Span_Event) XXX_Size() int { + return m.Size() +} +func (m *Span_Event) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Event.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Event proto.InternalMessageInfo func (m *Span_Event) GetTimeUnixNano() uint64 { if m != nil { @@ -448,7 +559,7 @@ func (m *Span_Event) GetName() string { return "" } -func (m *Span_Event) GetAttributes() []*opentelemetry_proto_common_v1.AttributeKeyValue { +func (m *Span_Event) GetAttributes() []*v11.KeyValue { if m != nil { return m.Attributes } @@ -475,16 +586,44 @@ type Span_Link struct { // The trace_state associated with the link. TraceState string `protobuf:"bytes,3,opt,name=trace_state,json=traceState,proto3" json:"trace_state,omitempty"` // attributes is a collection of attribute key/value pairs on the link. - Attributes []*opentelemetry_proto_common_v1.AttributeKeyValue `protobuf:"bytes,4,rep,name=attributes" json:"attributes,omitempty"` + Attributes []*v11.KeyValue `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` // dropped_attributes_count is the number of dropped attributes. If the value is 0, // then no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,5,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` } -func (m *Span_Link) Reset() { *m = Span_Link{} } -func (m *Span_Link) String() string { return proto.CompactTextString(m) } -func (*Span_Link) ProtoMessage() {} -func (*Span_Link) Descriptor() ([]byte, []int) { return fileDescriptorTrace, []int{2, 1} } +func (m *Span_Link) Reset() { *m = Span_Link{} } +func (m *Span_Link) String() string { return proto.CompactTextString(m) } +func (*Span_Link) ProtoMessage() {} +func (*Span_Link) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{2, 1} +} +func (m *Span_Link) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Span_Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Span_Link.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Span_Link) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Link.Merge(m, src) +} +func (m *Span_Link) XXX_Size() int { + return m.Size() +} +func (m *Span_Link) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Link.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Link proto.InternalMessageInfo func (m *Span_Link) GetTraceId() []byte { if m != nil { @@ -507,7 +646,7 @@ func (m *Span_Link) GetTraceState() string { return "" } -func (m *Span_Link) GetAttributes() []*opentelemetry_proto_common_v1.AttributeKeyValue { +func (m *Span_Link) GetAttributes() []*v11.KeyValue { if m != nil { return m.Attributes } @@ -531,10 +670,38 @@ type Status struct { Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` } -func (m *Status) Reset() { *m = Status{} } -func (m *Status) String() string { return proto.CompactTextString(m) } -func (*Status) ProtoMessage() {} -func (*Status) Descriptor() ([]byte, []int) { return fileDescriptorTrace, []int{3} } +func (m *Status) Reset() { *m = Status{} } +func (m *Status) String() string { return proto.CompactTextString(m) } +func (*Status) ProtoMessage() {} +func (*Status) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{3} +} +func (m *Status) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Status.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Status) XXX_Merge(src proto.Message) { + xxx_messageInfo_Status.Merge(m, src) +} +func (m *Status) XXX_Size() int { + return m.Size() +} +func (m *Status) XXX_DiscardUnknown() { + xxx_messageInfo_Status.DiscardUnknown(m) +} + +var xxx_messageInfo_Status proto.InternalMessageInfo func (m *Status) GetCode() Status_StatusCode { if m != nil { @@ -551,19 +718,94 @@ func (m *Status) GetMessage() string { } func init() { + proto.RegisterEnum("opentelemetry.proto.trace.v1.Span_SpanKind", Span_SpanKind_name, Span_SpanKind_value) + proto.RegisterEnum("opentelemetry.proto.trace.v1.Status_StatusCode", Status_StatusCode_name, Status_StatusCode_value) proto.RegisterType((*ResourceSpans)(nil), "opentelemetry.proto.trace.v1.ResourceSpans") proto.RegisterType((*InstrumentationLibrarySpans)(nil), "opentelemetry.proto.trace.v1.InstrumentationLibrarySpans") proto.RegisterType((*Span)(nil), "opentelemetry.proto.trace.v1.Span") proto.RegisterType((*Span_Event)(nil), "opentelemetry.proto.trace.v1.Span.Event") proto.RegisterType((*Span_Link)(nil), "opentelemetry.proto.trace.v1.Span.Link") proto.RegisterType((*Status)(nil), "opentelemetry.proto.trace.v1.Status") - proto.RegisterEnum("opentelemetry.proto.trace.v1.Span_SpanKind", Span_SpanKind_name, Span_SpanKind_value) - proto.RegisterEnum("opentelemetry.proto.trace.v1.Status_StatusCode", Status_StatusCode_name, Status_StatusCode_value) } + +func init() { + proto.RegisterFile("opentelemetry/proto/trace/v1/trace.proto", fileDescriptor_5c407ac9c675a601) +} + +var fileDescriptor_5c407ac9c675a601 = []byte{ + // 1045 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0x23, 0x45, + 0x10, 0xce, 0xf8, 0x3f, 0xe5, 0x9f, 0x4c, 0x7a, 0xb3, 0xd9, 0xd9, 0x2c, 0x78, 0x2d, 0x6b, 0x25, + 0x0c, 0xab, 0xb5, 0x49, 0x10, 0xd2, 0x22, 0x81, 0xc0, 0x6b, 0x4f, 0x90, 0x15, 0xe3, 0x58, 0xe3, + 0x78, 0x0f, 0x5c, 0xac, 0x8e, 0xbb, 0xf1, 0xb6, 0x32, 0xee, 0xb6, 0x7a, 0xda, 0x26, 0x39, 0xf0, + 0x0e, 0x5c, 0x78, 0x06, 0x9e, 0x82, 0x1b, 0x12, 0x1c, 0xf7, 0x82, 0xc4, 0x09, 0xa1, 0xe4, 0xc4, + 0x5b, 0xa0, 0xee, 0x99, 0xc9, 0xc6, 0x51, 0xe2, 0xec, 0x25, 0x97, 0xa4, 0xba, 0xea, 0xfb, 0xea, + 0xab, 0xea, 0xaa, 0xf1, 0x0c, 0xd4, 0xc4, 0x8c, 0x72, 0x45, 0x7d, 0x3a, 0xa5, 0x4a, 0x9e, 0x35, + 0x66, 0x52, 0x28, 0xd1, 0x50, 0x12, 0x8f, 0x69, 0x63, 0xb1, 0x1b, 0x1a, 0x75, 0xe3, 0x44, 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 0x1d, 0x49, 0x98, 0x48, 0x46, 0x1f, 0x3b, 0x04, 0x3d, 0x85, 0x7c, + 0xc8, 0x09, 0x14, 0x56, 0xd4, 0x49, 0x56, 0xac, 0xda, 0xba, 0x07, 0xc6, 0x35, 0xd0, 0x1e, 0xf4, + 0x0c, 0x4a, 0x33, 0x2c, 0x29, 0x57, 0xa3, 0x38, 0x41, 0xca, 0x24, 0x28, 0x84, 0xde, 0x41, 0x98, + 0x06, 0x41, 0x8a, 0xe3, 0x29, 0x75, 0xd2, 0x86, 0x6f, 0x6c, 0xf4, 0x35, 0xa4, 0x4e, 0x18, 0x27, + 0x4e, 0xa6, 0x62, 0xd5, 0x4a, 0x7b, 0xcf, 0xef, 0x6e, 0xc8, 0xfc, 0x39, 0x60, 0x9c, 0x78, 0x86, + 0x88, 0x1a, 0xb0, 0x15, 0x28, 0x2c, 0xd5, 0x48, 0xb1, 0x29, 0x1d, 0xcd, 0x39, 0x3b, 0x1d, 0x71, + 0xcc, 0x85, 0x93, 0xad, 0x58, 0xb5, 0x8c, 0xb7, 0x69, 0x62, 0x47, 0x6c, 0x4a, 0x87, 0x9c, 0x9d, + 0xf6, 0x30, 0x17, 0xe8, 0x39, 0x20, 0xca, 0xc9, 0x75, 0x78, 0xce, 0xc0, 0x37, 0x28, 0x27, 0x4b, + 0xe0, 0x6f, 0x01, 0xb0, 0x52, 0x92, 0x1d, 0xcf, 0x15, 0x0d, 0x9c, 0x75, 0x73, 0xeb, 0x1f, 0xdd, + 0x31, 0xd3, 0x03, 0x7a, 0xf6, 0x1a, 0xfb, 0x73, 0xea, 0x5d, 0xa1, 0xa2, 0x97, 0xe0, 0x10, 0x29, + 0x66, 0x33, 0x4a, 0x46, 0xef, 0xbc, 0xa3, 0xb1, 0x98, 0x73, 0xe5, 0x40, 0xc5, 0xaa, 0x15, 0xbd, + 0xed, 0x28, 0xde, 0xbc, 0x0c, 0xb7, 0x74, 0x14, 0x7d, 0x03, 0x19, 0xba, 0xa0, 0x5c,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e, + 0x9f, 0x7c, 0x09, 0x00, 0x00, +} + func (m *ResourceSpans) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -571,39 +813,48 @@ func (m *ResourceSpans) Marshal() (dAtA []byte, err error) { } func (m *ResourceSpans) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceSpans) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Resource != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.Resource.Size())) - n1, err := m.Resource.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } if len(m.InstrumentationLibrarySpans) > 0 { - for _, msg := range m.InstrumentationLibrarySpans { + for iNdEx := len(m.InstrumentationLibrarySpans) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InstrumentationLibrarySpans[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintTrace(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Resource != nil { + { + size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *InstrumentationLibrarySpans) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -611,39 +862,48 @@ func (m *InstrumentationLibrarySpans) Marshal() (dAtA []byte, err error) { } func (m *InstrumentationLibrarySpans) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InstrumentationLibrarySpans) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.InstrumentationLibrary != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.InstrumentationLibrary.Size())) - n2, err := m.InstrumentationLibrary.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } if len(m.Spans) > 0 { - for _, msg := range m.Spans { + for iNdEx := len(m.Spans) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Spans[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintTrace(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.InstrumentationLibrary != nil { + { + size, err := m.InstrumentationLibrary.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Span) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -651,123 +911,143 @@ func (m *Span) Marshal() (dAtA []byte, err error) { } func (m *Span) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Span) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.TraceId) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTrace(dAtA, i, uint64(len(m.TraceId))) - i += copy(dAtA[i:], m.TraceId) - } - if len(m.SpanId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTrace(dAtA, i, uint64(len(m.SpanId))) - i += copy(dAtA[i:], m.SpanId) - } - if len(m.TraceState) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTrace(dAtA, i, uint64(len(m.TraceState))) - i += copy(dAtA[i:], m.TraceState) - } - if len(m.ParentSpanId) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintTrace(dAtA, i, uint64(len(m.ParentSpanId))) - i += copy(dAtA[i:], m.ParentSpanId) - } - if len(m.Name) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintTrace(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if m.Kind != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.Kind)) - } - if m.StartTimeUnixNano != 0 { - dAtA[i] = 0x39 - i++ - i = encodeFixed64Trace(dAtA, i, uint64(m.StartTimeUnixNano)) - } - if m.EndTimeUnixNano != 0 { - dAtA[i] = 0x41 - i++ - i = encodeFixed64Trace(dAtA, i, uint64(m.EndTimeUnixNano)) - } - if len(m.Attributes) > 0 { - for _, msg := range m.Attributes { - dAtA[i] = 0x4a - i++ - i = encodeVarintTrace(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.Status != nil { + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x7a } - if m.DroppedAttributesCount != 0 { - dAtA[i] = 0x50 - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.DroppedAttributesCount)) + if m.DroppedLinksCount != 0 { + i = encodeVarintTrace(dAtA, i, uint64(m.DroppedLinksCount)) + i-- + dAtA[i] = 0x70 } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x5a - i++ - i = encodeVarintTrace(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Links) > 0 { + for iNdEx := len(m.Links) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Links[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x6a } } if m.DroppedEventsCount != 0 { - dAtA[i] = 0x60 - i++ i = encodeVarintTrace(dAtA, i, uint64(m.DroppedEventsCount)) + i-- + dAtA[i] = 0x60 } - if len(m.Links) > 0 { - for _, msg := range m.Links { - dAtA[i] = 0x6a - i++ - i = encodeVarintTrace(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x5a } } - if m.DroppedLinksCount != 0 { - dAtA[i] = 0x70 - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.DroppedLinksCount)) + if m.DroppedAttributesCount != 0 { + i = encodeVarintTrace(dAtA, i, uint64(m.DroppedAttributesCount)) + i-- + dAtA[i] = 0x50 } - if m.Status != nil { - dAtA[i] = 0x7a - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.Status.Size())) - n3, err := m.Status.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Attributes) > 0 { + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a } - i += n3 } - return i, nil + if m.EndTimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.EndTimeUnixNano)) + i-- + dAtA[i] = 0x41 + } + if m.StartTimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.StartTimeUnixNano)) + i-- + dAtA[i] = 0x39 + } + if m.Kind != 0 { + i = encodeVarintTrace(dAtA, i, uint64(m.Kind)) + i-- + dAtA[i] = 0x30 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTrace(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x2a + } + if len(m.ParentSpanId) > 0 { + i -= len(m.ParentSpanId) + copy(dAtA[i:], m.ParentSpanId) + i = encodeVarintTrace(dAtA, i, uint64(len(m.ParentSpanId))) + i-- + dAtA[i] = 0x22 + } + if len(m.TraceState) > 0 { + i -= len(m.TraceState) + copy(dAtA[i:], m.TraceState) + i = encodeVarintTrace(dAtA, i, uint64(len(m.TraceState))) + i-- + dAtA[i] = 0x1a + } + if len(m.SpanId) > 0 { + i -= len(m.SpanId) + copy(dAtA[i:], m.SpanId) + i = encodeVarintTrace(dAtA, i, uint64(len(m.SpanId))) + i-- + dAtA[i] = 0x12 + } + if len(m.TraceId) > 0 { + i -= len(m.TraceId) + copy(dAtA[i:], m.TraceId) + i = encodeVarintTrace(dAtA, i, uint64(len(m.TraceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Span_Event) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -775,45 +1055,54 @@ func (m *Span_Event) Marshal() (dAtA []byte, err error) { } func (m *Span_Event) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Span_Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TimeUnixNano != 0 { - dAtA[i] = 0x9 - i++ - i = encodeFixed64Trace(dAtA, i, uint64(m.TimeUnixNano)) - } - if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTrace(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.DroppedAttributesCount != 0 { + i = encodeVarintTrace(dAtA, i, uint64(m.DroppedAttributesCount)) + i-- + dAtA[i] = 0x20 } if len(m.Attributes) > 0 { - for _, msg := range m.Attributes { - dAtA[i] = 0x1a - i++ - i = encodeVarintTrace(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } - if m.DroppedAttributesCount != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.DroppedAttributesCount)) + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTrace(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.TimeUnixNano != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.TimeUnixNano)) + i-- + dAtA[i] = 0x9 } - return i, nil + return len(dAtA) - i, nil } func (m *Span_Link) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -821,52 +1110,62 @@ func (m *Span_Link) Marshal() (dAtA []byte, err error) { } func (m *Span_Link) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Span_Link) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.TraceId) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTrace(dAtA, i, uint64(len(m.TraceId))) - i += copy(dAtA[i:], m.TraceId) + if m.DroppedAttributesCount != 0 { + i = encodeVarintTrace(dAtA, i, uint64(m.DroppedAttributesCount)) + i-- + dAtA[i] = 0x28 } - if len(m.SpanId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTrace(dAtA, i, uint64(len(m.SpanId))) - i += copy(dAtA[i:], m.SpanId) + if len(m.Attributes) > 0 { + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrace(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } } if len(m.TraceState) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.TraceState) + copy(dAtA[i:], m.TraceState) i = encodeVarintTrace(dAtA, i, uint64(len(m.TraceState))) - i += copy(dAtA[i:], m.TraceState) + i-- + dAtA[i] = 0x1a } - if len(m.Attributes) > 0 { - for _, msg := range m.Attributes { - dAtA[i] = 0x22 - i++ - i = encodeVarintTrace(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if len(m.SpanId) > 0 { + i -= len(m.SpanId) + copy(dAtA[i:], m.SpanId) + i = encodeVarintTrace(dAtA, i, uint64(len(m.SpanId))) + i-- + dAtA[i] = 0x12 } - if m.DroppedAttributesCount != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.DroppedAttributesCount)) + if len(m.TraceId) > 0 { + i -= len(m.TraceId) + copy(dAtA[i:], m.TraceId) + i = encodeVarintTrace(dAtA, i, uint64(len(m.TraceId))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Status) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -874,52 +1173,45 @@ func (m *Status) Marshal() (dAtA []byte, err error) { } func (m *Status) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Status) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTrace(dAtA, i, uint64(m.Code)) - } if len(m.Message) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Message) + copy(dAtA[i:], m.Message) i = encodeVarintTrace(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) + i-- + dAtA[i] = 0x12 + } + if m.Code != 0 { + i = encodeVarintTrace(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } -func encodeFixed64Trace(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Trace(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintTrace(dAtA []byte, offset int, v uint64) int { + offset -= sovTrace(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ResourceSpans) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Resource != nil { @@ -936,6 +1228,9 @@ func (m *ResourceSpans) Size() (n int) { } func (m *InstrumentationLibrarySpans) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.InstrumentationLibrary != nil { @@ -952,6 +1247,9 @@ func (m *InstrumentationLibrarySpans) Size() (n int) { } func (m *Span) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.TraceId) @@ -1018,6 +1316,9 @@ func (m *Span) Size() (n int) { } func (m *Span_Event) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.TimeUnixNano != 0 { @@ -1040,6 +1341,9 @@ func (m *Span_Event) Size() (n int) { } func (m *Span_Link) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.TraceId) @@ -1067,6 +1371,9 @@ func (m *Span_Link) Size() (n int) { } func (m *Status) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Code != 0 { @@ -1080,14 +1387,7 @@ func (m *Status) Size() (n int) { } func sovTrace(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTrace(x uint64) (n int) { return sovTrace(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -1107,7 +1407,7 @@ func (m *ResourceSpans) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1135,7 +1435,7 @@ func (m *ResourceSpans) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1144,11 +1444,14 @@ func (m *ResourceSpans) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } if m.Resource == nil { - m.Resource = &opentelemetry_proto_resource_v1.Resource{} + m.Resource = &v1.Resource{} } if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1168,7 +1471,7 @@ func (m *ResourceSpans) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1177,6 +1480,9 @@ func (m *ResourceSpans) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1194,6 +1500,9 @@ func (m *ResourceSpans) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTrace } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrace + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1221,7 +1530,7 @@ func (m *InstrumentationLibrarySpans) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1249,7 +1558,7 @@ func (m *InstrumentationLibrarySpans) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1258,11 +1567,14 @@ func (m *InstrumentationLibrarySpans) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } if m.InstrumentationLibrary == nil { - m.InstrumentationLibrary = &opentelemetry_proto_common_v1.InstrumentationLibrary{} + m.InstrumentationLibrary = &v11.InstrumentationLibrary{} } if err := m.InstrumentationLibrary.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1282,7 +1594,7 @@ func (m *InstrumentationLibrarySpans) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1291,6 +1603,9 @@ func (m *InstrumentationLibrarySpans) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1308,6 +1623,9 @@ func (m *InstrumentationLibrarySpans) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTrace } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrace + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1335,7 +1653,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1363,7 +1681,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1372,6 +1690,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1394,7 +1715,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1403,6 +1724,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1425,7 +1749,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1435,6 +1759,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1454,7 +1781,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1463,6 +1790,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1485,7 +1815,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1495,6 +1825,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1514,7 +1847,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Kind |= (Span_SpanKind(b) & 0x7F) << shift + m.Kind |= Span_SpanKind(b&0x7F) << shift if b < 0x80 { break } @@ -1527,15 +1860,8 @@ func (m *Span) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.StartTimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.StartTimeUnixNano = uint64(dAtA[iNdEx-8]) - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.StartTimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 8: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field EndTimeUnixNano", wireType) @@ -1544,15 +1870,8 @@ func (m *Span) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.EndTimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.EndTimeUnixNano = uint64(dAtA[iNdEx-8]) - m.EndTimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.EndTimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.EndTimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.EndTimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.EndTimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.EndTimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.EndTimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) @@ -1567,7 +1886,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1576,10 +1895,13 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Attributes = append(m.Attributes, &opentelemetry_proto_common_v1.AttributeKeyValue{}) + m.Attributes = append(m.Attributes, &v11.KeyValue{}) if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1598,7 +1920,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DroppedAttributesCount |= (uint32(b) & 0x7F) << shift + m.DroppedAttributesCount |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1617,7 +1939,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1626,6 +1948,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1648,7 +1973,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DroppedEventsCount |= (uint32(b) & 0x7F) << shift + m.DroppedEventsCount |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1667,7 +1992,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1676,6 +2001,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1698,7 +2026,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DroppedLinksCount |= (uint32(b) & 0x7F) << shift + m.DroppedLinksCount |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1717,7 +2045,7 @@ func (m *Span) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1726,6 +2054,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1745,6 +2076,9 @@ func (m *Span) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTrace } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrace + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1772,7 +2106,7 @@ func (m *Span_Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1794,15 +2128,8 @@ func (m *Span_Event) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + m.TimeUnixNano = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.TimeUnixNano = uint64(dAtA[iNdEx-8]) - m.TimeUnixNano |= uint64(dAtA[iNdEx-7]) << 8 - m.TimeUnixNano |= uint64(dAtA[iNdEx-6]) << 16 - m.TimeUnixNano |= uint64(dAtA[iNdEx-5]) << 24 - m.TimeUnixNano |= uint64(dAtA[iNdEx-4]) << 32 - m.TimeUnixNano |= uint64(dAtA[iNdEx-3]) << 40 - m.TimeUnixNano |= uint64(dAtA[iNdEx-2]) << 48 - m.TimeUnixNano |= uint64(dAtA[iNdEx-1]) << 56 case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) @@ -1817,7 +2144,7 @@ func (m *Span_Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1827,6 +2154,9 @@ func (m *Span_Event) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1846,7 +2176,7 @@ func (m *Span_Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1855,10 +2185,13 @@ func (m *Span_Event) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Attributes = append(m.Attributes, &opentelemetry_proto_common_v1.AttributeKeyValue{}) + m.Attributes = append(m.Attributes, &v11.KeyValue{}) if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1877,7 +2210,7 @@ func (m *Span_Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DroppedAttributesCount |= (uint32(b) & 0x7F) << shift + m.DroppedAttributesCount |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1891,6 +2224,9 @@ func (m *Span_Event) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTrace } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrace + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1918,7 +2254,7 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1946,7 +2282,7 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1955,6 +2291,9 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1977,7 +2316,7 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1986,6 +2325,9 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2008,7 +2350,7 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2018,6 +2360,9 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2037,7 +2382,7 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -2046,10 +2391,13 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Attributes = append(m.Attributes, &opentelemetry_proto_common_v1.AttributeKeyValue{}) + m.Attributes = append(m.Attributes, &v11.KeyValue{}) if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2068,7 +2416,7 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DroppedAttributesCount |= (uint32(b) & 0x7F) << shift + m.DroppedAttributesCount |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -2082,6 +2430,9 @@ func (m *Span_Link) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTrace } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrace + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2109,7 +2460,7 @@ func (m *Status) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2137,7 +2488,7 @@ func (m *Status) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (Status_StatusCode(b) & 0x7F) << shift + m.Code |= Status_StatusCode(b&0x7F) << shift if b < 0x80 { break } @@ -2156,7 +2507,7 @@ func (m *Status) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2166,6 +2517,9 @@ func (m *Status) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTrace } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTrace + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -2180,6 +2534,9 @@ func (m *Status) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTrace } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrace + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -2195,6 +2552,7 @@ func (m *Status) Unmarshal(dAtA []byte) error { func skipTrace(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2226,10 +2584,8 @@ func skipTrace(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2246,124 +2602,34 @@ func skipTrace(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthTrace } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTrace - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTrace(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTrace + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTrace + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTrace = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTrace = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTrace = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTrace = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTrace = fmt.Errorf("proto: unexpected end of group") ) - -func init() { proto.RegisterFile("opentelemetry/proto/trace/v1/trace.proto", fileDescriptorTrace) } - -var fileDescriptorTrace = []byte{ - // 1038 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6f, 0x1b, 0x37, - 0x13, 0xf6, 0xea, 0xdb, 0xa3, 0x0f, 0xaf, 0x19, 0xc7, 0xd9, 0x38, 0xef, 0xeb, 0x08, 0x42, 0x80, - 0xaa, 0x0d, 0x22, 0xc5, 0x2e, 0x0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x4e, 0xaa, 0x9a, - 0xae, 0x17, 0xf7, 0x3f, 0x6f, 0xac, 0x2a, 0xbd, 0xd1, 0x5d, 0x0e, 0xd1, 0x8b, 0x22, 0x98, 0x44, - 0xbd, 0x67, 0xec, 0x76, 0x67, 0xed, 0x37, 0x0b, 0x9e, 0xad, 0x20, 0x23, 0x0e, 0x4f, 0x6e, 0x49, - 0x2f, 0x2e, 0xfa, 0xb3, 0x1b, 0x13, 0x8b, 0xcf, 0xfa, 0xd6, 0xcc, 0xbc, 0xed, 0x9b, 0x93, 0x42, - 0x6f, 0x20, 0x7b, 0xb5, 0xec, 0xda, 0xea, 0xb2, 0x75, 0x8e, 0x5e, 0x44, 0xa8, 0xfd, 0x08, 0x90, - 0xd1, 0x7b, 0xf4, 0x14, 0x0a, 0x06, 0x30, 0x66, 0xc4, 0xe4, 0x58, 0xf2, 0xf2, 0x66, 0xdf, 0x25, - 0xe8, 0x09, 0xe4, 0x35, 0x58, 0x7b, 0x52, 0xc6, 0x93, 0xd3, 0xdb, 0x2e, 0x41, 0xcf, 0xa1, 0x18, - 0x71, 0x02, 0x85, 0x15, 0x75, 0xd2, 0x55, 0xab, 0xbe, 0xee, 0x81, 0x31, 0x0d, 0xb5, 0x05, 0xbd, - 0x80, 0xca, 0x1c, 0x4b, 0xca, 0xd5, 0x38, 0x09, 0x90, 0x31, 0x01, 0x4a, 0x91, 0x75, 0x18, 0x85, - 0x41, 0x90, 0xe1, 0x78, 0x46, 0x9d, 0xac, 0xe1, 0x9b, 0x35, 0xfa, 0x0a, 0x32, 0xa7, 0x8c, 0x13, - 0x27, 0x57, 0xb5, 0xea, 0x95, 0xfd, 0x97, 0x77, 0x17, 0x64, 0x7e, 0x0e, 0x19, 0x27, 0x9e, 0x21, - 0xa2, 0x26, 0x6c, 0x05, 0x0a, 0x4b, 0x35, 0x56, 0x6c, 0x46, 0xc7, 0x21, 0x67, 0x67, 0x63, 0x8e, - 0xb9, 0x70, 0xf2, 0x55, 0xab, 0x9e,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x3a, 0x8c, 0xfd, 0xf6, 0x27, 0xeb, 0xf7, 0x8b, - 0x5d, 0xeb, 0xcf, 0x8b, 0x5d, 0xeb, 0xef, 0x8b, 0x5d, 0xeb, 0xe7, 0x7f, 0x76, 0xd7, 0xe0, 0x39, - 0x13, 0x2b, 0xbb, 0xf4, 0x16, 0x8e, 0xf5, 0x6a, 0xa0, 0x8d, 0x03, 0xeb, 0xdb, 0xde, 0xf4, 0x3a, - 0x9c, 0xe9, 0x0f, 0x1e, 0xdf, 0xa7, 0x13, 0x25, 0x64, 0x93, 0xc5, 0x49, 0x36, 0x09, 0x56, 0xb8, - 0xb9, 0x04, 0x7c, 0x65, 0xe2, 0xbe, 0x9a, 0x52, 0x7e, 0xf9, 0xa1, 0x75, 0x92, 0x33, 0xb6, 0x4f, - 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x90, 0xd9, 0x1a, 0x89, 0x8f, 0x09, 0x00, 0x00, -} diff --git a/internal/data/testdata/common.go b/internal/data/testdata/common.go index 14699830e562..f76155928995 100644 --- a/internal/data/testdata/common.go +++ b/internal/data/testdata/common.go @@ -44,11 +44,11 @@ func initResourceAttributes1(dest pdata.AttributeMap) { dest.InitFromMap(resourceAttributes1) } -func generateOtlpResourceAttributes1() []*otlpcommon.AttributeKeyValue { - return []*otlpcommon.AttributeKeyValue{ +func generateOtlpResourceAttributes1() []*otlpcommon.KeyValue { + return []*otlpcommon.KeyValue{ { - Key: "resource-attr", - StringValue: "resource-attr-val-1", + Key: "resource-attr", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "resource-attr-val-1"}}, }, } } @@ -57,11 +57,11 @@ func initResourceAttributes2(dest pdata.AttributeMap) { dest.InitFromMap(resourceAttributes2) } -func generateOtlpResourceAttributes2() []*otlpcommon.AttributeKeyValue { - return []*otlpcommon.AttributeKeyValue{ +func generateOtlpResourceAttributes2() []*otlpcommon.KeyValue { + return []*otlpcommon.KeyValue{ { - Key: "resource-attr", - StringValue: "resource-attr-val-2", + Key: "resource-attr", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "resource-attr-val-2"}}, }, } } @@ -70,11 +70,11 @@ func initSpanAttributes(dest pdata.AttributeMap) { dest.InitFromMap(spanAttributes) } -func generateOtlpSpanAttributes() []*otlpcommon.AttributeKeyValue { - return []*otlpcommon.AttributeKeyValue{ +func generateOtlpSpanAttributes() []*otlpcommon.KeyValue { + return []*otlpcommon.KeyValue{ { - Key: "span-attr", - StringValue: "span-attr-val", + Key: "span-attr", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "span-attr-val"}}, }, } } @@ -83,11 +83,11 @@ func initSpanEventAttributes(dest pdata.AttributeMap) { dest.InitFromMap(spanEventAttributes) } -func generateOtlpSpanEventAttributes() []*otlpcommon.AttributeKeyValue { - return []*otlpcommon.AttributeKeyValue{ +func generateOtlpSpanEventAttributes() []*otlpcommon.KeyValue { + return []*otlpcommon.KeyValue{ { - Key: "span-event-attr", - StringValue: "span-event-attr-val", + Key: "span-event-attr", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "span-event-attr-val"}}, }, } } @@ -96,11 +96,11 @@ func initSpanLinkAttributes(dest pdata.AttributeMap) { dest.InitFromMap(spanLinkAttributes) } -func generateOtlpSpanLinkAttributes() []*otlpcommon.AttributeKeyValue { - return []*otlpcommon.AttributeKeyValue{ +func generateOtlpSpanLinkAttributes() []*otlpcommon.KeyValue { + return []*otlpcommon.KeyValue{ { - Key: "span-link-attr", - StringValue: "span-link-attr-val", + Key: "span-link-attr", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "span-link-attr-val"}}, }, } } diff --git a/internal/data/testdata/log.go b/internal/data/testdata/log.go index 139f94a8af5e..69bdc82c11ac 100644 --- a/internal/data/testdata/log.go +++ b/internal/data/testdata/log.go @@ -21,7 +21,7 @@ import ( otlplogs "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/logs/v1" "go.opentelemetry.io/collector/consumer/pdata" - opentelemetry_proto_common_v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" + otlpcommon "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" ) var ( @@ -250,16 +250,14 @@ func generateOtlpLogOne() *otlplogs.LogRecord { Body: "This is a log message", SpanId: []byte{0x01, 0x02, 0x04, 0x08}, TraceId: []byte{0x08, 0x04, 0x02, 0x01}, - Attributes: []*opentelemetry_proto_common_v1.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "app", - Type: opentelemetry_proto_common_v1.AttributeKeyValue_STRING, - StringValue: "server", + Key: "app", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "server"}}, }, { - Key: "instance_num", - Type: opentelemetry_proto_common_v1.AttributeKeyValue_INT, - IntValue: 1, + Key: "instance_num", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_IntValue{IntValue: 1}}, }, }, } @@ -287,14 +285,14 @@ func generateOtlpLogTwo() *otlplogs.LogRecord { SeverityNumber: otlplogs.SeverityNumber_INFO, SeverityText: "Info", Body: "something happened", - Attributes: []*opentelemetry_proto_common_v1.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "customer", - StringValue: "acme", + Key: "customer", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "acme"}}, }, { - Key: "env", - StringValue: "dev", + Key: "env", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "dev"}}, }, }, } diff --git a/internal/goldendataset/generator_commons.go b/internal/goldendataset/generator_commons.go index 0a911c2a3537..20b5c902867e 100644 --- a/internal/goldendataset/generator_commons.go +++ b/internal/goldendataset/generator_commons.go @@ -25,11 +25,11 @@ import ( otlpcommon "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" ) -func convertMapToAttributeKeyValues(attrsMap map[string]interface{}) []*otlpcommon.AttributeKeyValue { +func convertMapToAttributeKeyValues(attrsMap map[string]interface{}) []*otlpcommon.KeyValue { if attrsMap == nil { return nil } - attrList := make([]*otlpcommon.AttributeKeyValue, len(attrsMap)) + attrList := make([]*otlpcommon.KeyValue, len(attrsMap)) index := 0 for key, value := range attrsMap { attrList[index] = constructAttributeKeyValue(key, value) @@ -38,32 +38,28 @@ func convertMapToAttributeKeyValues(attrsMap map[string]interface{}) []*otlpcomm return attrList } -func constructAttributeKeyValue(key string, value interface{}) *otlpcommon.AttributeKeyValue { - var attr otlpcommon.AttributeKeyValue +func constructAttributeKeyValue(key string, value interface{}) *otlpcommon.KeyValue { + var attr otlpcommon.KeyValue switch val := value.(type) { case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: - attr = otlpcommon.AttributeKeyValue{ - Key: key, - Type: otlpcommon.AttributeKeyValue_INT, - IntValue: cast.ToInt64(val), + attr = otlpcommon.KeyValue{ + Key: key, + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_IntValue{IntValue: cast.ToInt64(val)}}, } case float32, float64: - attr = otlpcommon.AttributeKeyValue{ - Key: key, - Type: otlpcommon.AttributeKeyValue_DOUBLE, - DoubleValue: cast.ToFloat64(val), + attr = otlpcommon.KeyValue{ + Key: key, + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_DoubleValue{DoubleValue: cast.ToFloat64(val)}}, } case bool: - attr = otlpcommon.AttributeKeyValue{ - Key: key, - Type: otlpcommon.AttributeKeyValue_BOOL, - BoolValue: cast.ToBool(val), + attr = otlpcommon.KeyValue{ + Key: key, + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_BoolValue{BoolValue: cast.ToBool(val)}}, } default: - attr = otlpcommon.AttributeKeyValue{ - Key: key, - Type: otlpcommon.AttributeKeyValue_STRING, - StringValue: val.(string), + attr = otlpcommon.KeyValue{ + Key: key, + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: val.(string)}}, } } return &attr diff --git a/internal/goldendataset/span_generator.go b/internal/goldendataset/span_generator.go index 286f7fb9ec8c..2d44966014a7 100644 --- a/internal/goldendataset/span_generator.go +++ b/internal/goldendataset/span_generator.go @@ -188,7 +188,7 @@ func lookupSpanKind(kind PICTInputKind) otlptrace.Span_SpanKind { } } -func generateSpanAttributes(spanTypeID PICTInputAttributes) []*otlpcommon.AttributeKeyValue { +func generateSpanAttributes(spanTypeID PICTInputAttributes) []*otlpcommon.KeyValue { var attrs map[string]interface{} switch spanTypeID { case SpanAttrNil: @@ -484,7 +484,7 @@ func generateSpanEvent(index int) *otlptrace.Span_Event { } } -func generateEventAttributes(index int) []*otlpcommon.AttributeKeyValue { +func generateEventAttributes(index int) []*otlpcommon.KeyValue { attrMap := make(map[string]interface{}) if index%2 == 0 { attrMap[conventions.AttributeMessageType] = "SENT" @@ -507,7 +507,7 @@ func generateSpanLink(index int, random io.Reader) *otlptrace.Span_Link { } } -func generateLinkAttributes(index int) []*otlpcommon.AttributeKeyValue { +func generateLinkAttributes(index int) []*otlpcommon.KeyValue { attrMap := generateMessagingConsumerAttributes() return convertMapToAttributeKeyValues(attrMap) } diff --git a/receiver/otlpreceiver/metrics/otlp_test.go b/receiver/otlpreceiver/metrics/otlp_test.go index 8742be5ec4c8..671715038a8f 100644 --- a/receiver/otlpreceiver/metrics/otlp_test.go +++ b/receiver/otlpreceiver/metrics/otlp_test.go @@ -58,10 +58,10 @@ func TestExport(t *testing.T) { resourceMetrics := []*otlpmetrics.ResourceMetrics{ { Resource: &otlpresource.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "key1", - StringValue: "value1", + Key: "key1", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "value1"}}, }, }, }, diff --git a/receiver/otlpreceiver/otlp_test.go b/receiver/otlpreceiver/otlp_test.go index 75cf7efe15f7..cecca8b8e145 100644 --- a/receiver/otlpreceiver/otlp_test.go +++ b/receiver/otlpreceiver/otlp_test.go @@ -80,7 +80,7 @@ func TestGrpcGateway_endToEnd(t *testing.T) { "attributes": [ { "key": "host.hostname", - "string_value": "testHost" + "value": { "stringValue": "testHost" } } ] }, @@ -96,8 +96,7 @@ func TestGrpcGateway_endToEnd(t *testing.T) { "attributes": [ { "key": "attr1", - "type": 1, - "int_value": 55 + "value": { "intValue": 55 } } ] } @@ -139,11 +138,10 @@ func TestGrpcGateway_endToEnd(t *testing.T) { want := pdata.TracesFromOtlp([]*otlptrace.ResourceSpans{ { Resource: &otlpresource.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: conventions.AttributeHostHostname, - StringValue: "testHost", - Type: otlpcommon.AttributeKeyValue_STRING, + Key: conventions.AttributeHostHostname, + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "testHost"}}, }, }, }, @@ -156,11 +154,10 @@ func TestGrpcGateway_endToEnd(t *testing.T) { Name: "testSpan", StartTimeUnixNano: 1544712660000000000, EndTimeUnixNano: 1544712661000000000, - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "attr1", - Type: otlpcommon.AttributeKeyValue_INT, - IntValue: 55, + Key: "attr1", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_IntValue{IntValue: 55}}, }, }, }, @@ -366,10 +363,10 @@ func runContentTypeTests(addr string, contentTypeDesignation bool, contentType s ResourceSpans: []*otlptrace.ResourceSpans{ { Resource: &otlpresource.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "sub-type", - StringValue: contentType, + Key: "sub-type", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: contentType}}, }, }, }, @@ -573,10 +570,10 @@ func TestOTLPReceiverTrace_HandleNextConsumerResponse(t *testing.T) { ResourceSpans: []*otlptrace.ResourceSpans{ { Resource: &otlpresource.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: conventions.AttributeServiceName, - StringValue: "test-svc", + Key: conventions.AttributeServiceName, + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "test-svc"}}, }, }, }, diff --git a/receiver/otlpreceiver/trace/otlp_test.go b/receiver/otlpreceiver/trace/otlp_test.go index eb4dd4aacdd4..d5ea7b31a93c 100644 --- a/receiver/otlpreceiver/trace/otlp_test.go +++ b/receiver/otlpreceiver/trace/otlp_test.go @@ -63,10 +63,10 @@ func TestExport(t *testing.T) { resourceSpans := []*otlptrace.ResourceSpans{ { Resource: &otlpresource.Resource{ - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "key1", - StringValue: "value1", + Key: "key1", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "value1"}}, }, }, }, @@ -88,11 +88,10 @@ func TestExport(t *testing.T) { { TimeUnixNano: unixnanos, Name: "event1", - Attributes: []*otlpcommon.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "eventattr1", - Type: otlpcommon.AttributeKeyValue_STRING, - StringValue: "eventattrval1", + Key: "eventattr1", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "eventattrval1"}}, }, }, DroppedAttributesCount: 4, diff --git a/testbed/testbed/validator.go b/testbed/testbed/validator.go index 927401a21b43..8170d4f398aa 100644 --- a/testbed/testbed/validator.go +++ b/testbed/testbed/validator.go @@ -18,6 +18,7 @@ import ( "encoding/hex" "fmt" "log" + "reflect" "sort" "time" @@ -418,25 +419,21 @@ func (v *CorrectnessTestValidator) diffSpanStatus(sentSpan *otlptrace.Span, recd } } -func (v *CorrectnessTestValidator) diffAttributesSlice(spanName string, recdAttrs []*otlpcommon.AttributeKeyValue, - sentAttrs []*otlpcommon.AttributeKeyValue, fmtStr string) { +func (v *CorrectnessTestValidator) diffAttributesSlice(spanName string, recdAttrs []*otlpcommon.KeyValue, + sentAttrs []*otlpcommon.KeyValue, fmtStr string) { recdAttrsMap := convertAttributesSliceToMap(recdAttrs) for _, sentAttr := range sentAttrs { recdAttr, ok := recdAttrsMap[sentAttr.Key] if ok { - matchingVals := false - if sentAttr.Type == recdAttr.Type { - sentVal := retrieveAttributeValue(sentAttr) - recdVal := retrieveAttributeValue(recdAttr) - matchingVals = sentVal == recdVal - } - if !matchingVals { + sentVal := retrieveAttributeValue(sentAttr) + recdVal := retrieveAttributeValue(recdAttr) + if !reflect.DeepEqual(sentVal, recdVal) { af := &AssertionFailure{ typeName: "Span", dataComboName: spanName, fieldPath: fmt.Sprintf(fmtStr, sentAttr.Key), - expectedValue: retrieveAttributeValue(sentAttr), - actualValue: retrieveAttributeValue(recdAttr), + expectedValue: sentVal, + actualValue: recdVal, } v.assertionFailures = append(v.assertionFailures, af) } @@ -453,25 +450,33 @@ func (v *CorrectnessTestValidator) diffAttributesSlice(spanName string, recdAttr } } -func convertAttributesSliceToMap(attributes []*otlpcommon.AttributeKeyValue) map[string]*otlpcommon.AttributeKeyValue { - attrMap := make(map[string]*otlpcommon.AttributeKeyValue) +func convertAttributesSliceToMap(attributes []*otlpcommon.KeyValue) map[string]*otlpcommon.KeyValue { + attrMap := make(map[string]*otlpcommon.KeyValue) for _, attr := range attributes { attrMap[attr.Key] = attr } return attrMap } -func retrieveAttributeValue(attribute *otlpcommon.AttributeKeyValue) interface{} { +func retrieveAttributeValue(attribute *otlpcommon.KeyValue) interface{} { + if attribute.Value == nil || attribute.Value.Value == nil { + return nil + } + var attrVal interface{} - switch attribute.Type { - case otlpcommon.AttributeKeyValue_STRING: - attrVal = attribute.StringValue - case otlpcommon.AttributeKeyValue_INT: - attrVal = attribute.IntValue - case otlpcommon.AttributeKeyValue_DOUBLE: - attrVal = attribute.DoubleValue - case otlpcommon.AttributeKeyValue_BOOL: - attrVal = attribute.BoolValue + switch val := attribute.Value.Value.(type) { + case *otlpcommon.AnyValue_StringValue: + attrVal = val.StringValue + case *otlpcommon.AnyValue_IntValue: + attrVal = val.IntValue + case *otlpcommon.AnyValue_DoubleValue: + attrVal = val.DoubleValue + case *otlpcommon.AnyValue_BoolValue: + attrVal = val.BoolValue + case *otlpcommon.AnyValue_ArrayValue: + attrVal = val.ArrayValue + case *otlpcommon.AnyValue_KvlistValue: + attrVal = val.KvlistValue default: attrVal = nil } diff --git a/testbed/tests/resource_processor_test.go b/testbed/tests/resource_processor_test.go index a293b5a81266..ad1958c8ac64 100644 --- a/testbed/tests/resource_processor_test.go +++ b/testbed/tests/resource_processor_test.go @@ -15,16 +15,16 @@ package tests import ( - "encoding/json" "path" "path/filepath" "testing" + "github.com/golang/protobuf/jsonpb" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/consumer/pdatautil" "go.opentelemetry.io/collector/internal/data" - v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" + otlpcommon "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" otlpmetrics "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1" otlpresource "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1" "go.opentelemetry.io/collector/testbed/testbed" @@ -37,11 +37,11 @@ const ( "attributes": [ { "key": "opencensus.resourcetype", - "string_value": "host" + "value": { "stringValue": "host" } }, { "key": "label-key", - "string_value": "label-value" + "value": { "stringValue": "label-value" } } ] }, @@ -73,7 +73,7 @@ const ( "attributes": [ { "key": "label-key", - "string_value": "label-value" + "value": { "stringValue": "label-value" } } ] }, @@ -171,18 +171,18 @@ func getResourceProcessorTestCases(t *testing.T) []resourceProcessorTestCase { mockedConsumedMetricData: getMetricDataFromJSON(t, mockedConsumedResourceWithTypeJSON), expectedMetricData: getMetricDataFromResourceMetrics(&otlpmetrics.ResourceMetrics{ Resource: &otlpresource.Resource{ - Attributes: []*v1.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "opencensus.resourcetype", - StringValue: "vm", + Key: "opencensus.resourcetype", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "vm"}}, }, { - Key: "label-key", - StringValue: "label-value", + Key: "label-key", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "label-value"}}, }, { - Key: "additional-label-key", - StringValue: "additional-label-value", + Key: "additional-label-key", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "additional-label-value"}}, }, }, }, @@ -218,14 +218,14 @@ func getResourceProcessorTestCases(t *testing.T) []resourceProcessorTestCase { mockedConsumedMetricData: getMetricDataFromJSON(t, mockedConsumedResourceWithoutTypeJSON), expectedMetricData: getMetricDataFromResourceMetrics(&otlpmetrics.ResourceMetrics{ Resource: &otlpresource.Resource{ - Attributes: []*v1.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "label-key", - StringValue: "label-value", + Key: "label-key", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "label-value"}}, }, { - Key: "additional-label-key", - StringValue: "additional-label-value", + Key: "additional-label-key", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "additional-label-value"}}, }, }, }, @@ -243,10 +243,10 @@ func getResourceProcessorTestCases(t *testing.T) []resourceProcessorTestCase { expectedMetricData: getMetricDataFromResourceMetrics(&otlpmetrics.ResourceMetrics{ Resource: &otlpresource.Resource{ - Attributes: []*v1.AttributeKeyValue{ + Attributes: []*otlpcommon.KeyValue{ { - Key: "additional-label-key", - StringValue: "additional-label-value", + Key: "additional-label-key", + Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "additional-label-value"}}, }, }, }, @@ -264,7 +264,7 @@ func getMetricDataFromResourceMetrics(rm *otlpmetrics.ResourceMetrics) data.Metr func getMetricDataFromJSON(t *testing.T, rmString string) data.MetricData { var mockedResourceMetrics otlpmetrics.ResourceMetrics - err := json.Unmarshal([]byte(rmString), &mockedResourceMetrics) + err := jsonpb.UnmarshalString(rmString, &mockedResourceMetrics) require.NoError(t, err, "failed to get mocked resource metrics object", err) return data.MetricDataFromOtlp([]*otlpmetrics.ResourceMetrics{&mockedResourceMetrics}) diff --git a/translator/internaldata/resource_to_oc.go b/translator/internaldata/resource_to_oc.go index cdf9050efa7d..b6a9ab457885 100644 --- a/translator/internaldata/resource_to_oc.go +++ b/translator/internaldata/resource_to_oc.go @@ -17,6 +17,7 @@ package internaldata import ( "fmt" "strconv" + "strings" "time" occommon "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1" @@ -42,7 +43,7 @@ func internalResourceToOC(resource pdata.Resource) (*occommon.Node, *ocresource. labels := make(map[string]string, attrs.Len()) attrs.ForEach(func(k string, v pdata.AttributeValue) { - val := attributeValueToString(v) + val := attributeValueToString(v, false) switch k { case conventions.OCAttributeResourceType: @@ -106,17 +107,48 @@ func internalResourceToOC(resource pdata.Resource) (*occommon.Node, *ocresource. return &ocNode, &ocResource } -func attributeValueToString(attr pdata.AttributeValue) string { +func attributeValueToString(attr pdata.AttributeValue, jsonLike bool) string { switch attr.Type() { + case pdata.AttributeValueNULL: + if jsonLike { + return "null" + } + return "" case pdata.AttributeValueSTRING: + if jsonLike { + return fmt.Sprintf("%q", attr.StringVal()) + } return attr.StringVal() + case pdata.AttributeValueBOOL: return strconv.FormatBool(attr.BoolVal()) + case pdata.AttributeValueDOUBLE: return strconv.FormatFloat(attr.DoubleVal(), 'f', -1, 64) + case pdata.AttributeValueINT: return strconv.FormatInt(attr.IntVal(), 10) + + case pdata.AttributeValueMAP: + // OpenCensus attributes cannot represent maps natively. Convert the + // map to a JSON-like string. + var sb strings.Builder + sb.WriteString("{") + m := attr.MapVal() + first := true + m.ForEach(func(k string, v pdata.AttributeValue) { + if !first { + sb.WriteString(",") + } + first = false + sb.WriteString(fmt.Sprintf("%q:%s", k, attributeValueToString(v, true))) + }) + sb.WriteString("}") + return sb.String() + default: return fmt.Sprintf("", attr.Type()) } + + // TODO: Add support for ARRAY type. } diff --git a/translator/internaldata/resource_to_oc_test.go b/translator/internaldata/resource_to_oc_test.go index 6e423db5ef51..31c685639b29 100644 --- a/translator/internaldata/resource_to_oc_test.go +++ b/translator/internaldata/resource_to_oc_test.go @@ -74,6 +74,22 @@ func TestResourceToOC(t *testing.T) { } } +func TestAttributeValueToString(t *testing.T) { + assert.EqualValues(t, "", attributeValueToString(pdata.NewAttributeValueNull(), false)) + assert.EqualValues(t, "abc", attributeValueToString(pdata.NewAttributeValueString("abc"), false)) + assert.EqualValues(t, `"abc"`, attributeValueToString(pdata.NewAttributeValueString("abc"), true)) + assert.EqualValues(t, "123", attributeValueToString(pdata.NewAttributeValueInt(123), false)) + assert.EqualValues(t, "1.23", attributeValueToString(pdata.NewAttributeValueDouble(1.23), false)) + assert.EqualValues(t, "true", attributeValueToString(pdata.NewAttributeValueBool(true), false)) + + v := pdata.NewAttributeValueMap() + v.MapVal().InsertString(`a"\`, `b"\`) + v.MapVal().InsertInt("c", 123) + v.MapVal().Insert("d", pdata.NewAttributeValueNull()) + v.MapVal().Insert("e", v) + assert.EqualValues(t, `{"a\"\\":"b\"\\","c":123,"d":null,"e":{"a\"\\":"b\"\\","c":123,"d":null}}`, attributeValueToString(v, false)) +} + func BenchmarkInternalResourceToOC(b *testing.B) { resource := generateResourceWithOcNodeAndResource()