diff --git a/.chloggen/profiles-otlp-1-8-0.yaml b/.chloggen/profiles-otlp-1-8-0.yaml index f7a88d1ef9..9f73e70b06 100644 --- a/.chloggen/profiles-otlp-1-8-0.yaml +++ b/.chloggen/profiles-otlp-1-8-0.yaml @@ -10,7 +10,7 @@ component: pdata/pprofile note: Upgrade the OTLP protobuf definitions to version 1.8.0 # One or more tracking issues or pull requests related to the change -issues: [13758] +issues: [13758, 13825] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document. diff --git a/internal/cmd/pdatagen/internal/pdata/pprofile_package.go b/internal/cmd/pdatagen/internal/pdata/pprofile_package.go index 138a38702d..8b958f39df 100644 --- a/internal/cmd/pdatagen/internal/pdata/pprofile_package.go +++ b/internal/cmd/pdatagen/internal/pdata/pprofile_package.go @@ -232,13 +232,7 @@ var profile = &messageStruct{ fieldName: "Time", originFieldName: "TimeUnixNano", protoID: 3, - returnType: &TypedType{ - structName: "Timestamp", - packageName: "pcommon", - protoType: proto.TypeUint64, - defaultVal: "0", - testVal: "1234567890", - }, + returnType: timestampType, }, &TypedField{ fieldName: "Duration", diff --git a/pdata/internal/generated_wrapper_profile.go b/pdata/internal/generated_wrapper_profile.go index d471731561..c3b3994a7e 100644 --- a/pdata/internal/generated_wrapper_profile.go +++ b/pdata/internal/generated_wrapper_profile.go @@ -7,6 +7,7 @@ package internal import ( + "encoding/binary" "fmt" "sync" @@ -214,7 +215,7 @@ func SizeProtoOrigProfile(orig *otlpprofiles.Profile) int { n += 1 + proto.Sov(uint64(l)) + l } if orig.TimeUnixNano != 0 { - n += 1 + proto.Sov(uint64(orig.TimeUnixNano)) + n += 9 } if orig.DurationNano != 0 { n += 1 + proto.Sov(uint64(orig.DurationNano)) @@ -273,9 +274,10 @@ func MarshalProtoOrigProfile(orig *otlpprofiles.Profile, buf []byte) int { buf[pos] = 0x12 } if orig.TimeUnixNano != 0 { - pos = proto.EncodeVarint(buf, pos, uint64(orig.TimeUnixNano)) + pos -= 8 + binary.LittleEndian.PutUint64(buf[pos:], uint64(orig.TimeUnixNano)) pos-- - buf[pos] = 0x18 + buf[pos] = 0x19 } if orig.DurationNano != 0 { pos = proto.EncodeVarint(buf, pos, uint64(orig.DurationNano)) @@ -393,11 +395,11 @@ func UnmarshalProtoOrigProfile(orig *otlpprofiles.Profile, buf []byte) error { } case 3: - if wireType != proto.WireTypeVarint { + if wireType != proto.WireTypeI64 { return fmt.Errorf("proto: wrong wireType = %d for field TimeUnixNano", wireType) } var num uint64 - num, pos, err = proto.ConsumeVarint(buf, pos) + num, pos, err = proto.ConsumeI64(buf, pos) if err != nil { return err } diff --git a/pdata/internal/generated_wrapper_profile_test.go b/pdata/internal/generated_wrapper_profile_test.go index 606067f2a0..dcc0940d8c 100644 --- a/pdata/internal/generated_wrapper_profile_test.go +++ b/pdata/internal/generated_wrapper_profile_test.go @@ -145,7 +145,7 @@ func genTestFailingUnmarshalProtoValuesProfile() map[string][]byte { "Sample/wrong_wire_type": {0x14}, "Sample/missing_value": {0x12}, "TimeUnixNano/wrong_wire_type": {0x1c}, - "TimeUnixNano/missing_value": {0x18}, + "TimeUnixNano/missing_value": {0x19}, "DurationNano/wrong_wire_type": {0x24}, "DurationNano/missing_value": {0x20}, "PeriodType/wrong_wire_type": {0x2c}, diff --git a/service/internal/graph/obs_test.go b/service/internal/graph/obs_test.go index d36b53bf75..7f8170b7db 100644 --- a/service/internal/graph/obs_test.go +++ b/service/internal/graph/obs_test.go @@ -548,7 +548,7 @@ func TestComponentInstrumentation(t *testing.T) { "otelcol.receiver.produced.size": simpleMetric{ attribute.NewSet( attribute.String(obsconsumer.ComponentOutcome, "success"), - ): 1271, + ): 1254, }, }, attribute.NewSet( @@ -570,12 +570,12 @@ func TestComponentInstrumentation(t *testing.T) { "otelcol.processor.consumed.size": simpleMetric{ attribute.NewSet( attribute.String(obsconsumer.ComponentOutcome, "success"), - ): 1271, + ): 1254, }, "otelcol.processor.produced.size": simpleMetric{ attribute.NewSet( attribute.String(obsconsumer.ComponentOutcome, "success"), - ): 1271, + ): 1254, }, }, attribute.NewSet( @@ -602,17 +602,17 @@ func TestComponentInstrumentation(t *testing.T) { "otelcol.connector.consumed.size": simpleMetric{ attribute.NewSet( attribute.String(obsconsumer.ComponentOutcome, "success"), - ): 1271, + ): 1254, }, "otelcol.connector.produced.size": simpleMetric{ attribute.NewSet( attribute.String(obsconsumer.ComponentOutcome, "success"), attribute.String("otelcol.pipeline.id", "profiles/right"), - ): 668, + ): 659, attribute.NewSet( attribute.String(obsconsumer.ComponentOutcome, "success"), attribute.String("otelcol.pipeline.id", "profiles/left"), - ): 603, + ): 595, }, }, attribute.NewSet( @@ -628,7 +628,7 @@ func TestComponentInstrumentation(t *testing.T) { "otelcol.exporter.consumed.size": simpleMetric{ attribute.NewSet( attribute.String(obsconsumer.ComponentOutcome, "success"), - ): 668, + ): 659, }, }, attribute.NewSet( @@ -644,7 +644,7 @@ func TestComponentInstrumentation(t *testing.T) { "otelcol.exporter.consumed.size": simpleMetric{ attribute.NewSet( attribute.String(obsconsumer.ComponentOutcome, "success"), - ): 603, + ): 595, }, }, }