Fix pprofile timestamp unix nano to be a fixed64 (#13825)

This was missed in my previous PR. The `timestamp_unix_nano` field has
changed to be a fixed rather than uint.
See
https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/profiles/v1development/profiles.proto#L257
This commit is contained in:
Damien Mathieu 2025-09-14 18:19:01 +02:00 committed by GitHub
parent 3089704c8a
commit 2e9dda5297
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 22 deletions

View File

@ -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.

View File

@ -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",

View File

@ -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
}

View File

@ -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},

View File

@ -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,
},
},
}