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:
parent
3089704c8a
commit
2e9dda5297
|
|
@ -10,7 +10,7 @@ component: pdata/pprofile
|
||||||
note: Upgrade the OTLP protobuf definitions to version 1.8.0
|
note: Upgrade the OTLP protobuf definitions to version 1.8.0
|
||||||
|
|
||||||
# One or more tracking issues or pull requests related to the change
|
# 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.
|
# (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.
|
# These lines will be padded with 2 spaces and then inserted directly into the document.
|
||||||
|
|
|
||||||
|
|
@ -232,13 +232,7 @@ var profile = &messageStruct{
|
||||||
fieldName: "Time",
|
fieldName: "Time",
|
||||||
originFieldName: "TimeUnixNano",
|
originFieldName: "TimeUnixNano",
|
||||||
protoID: 3,
|
protoID: 3,
|
||||||
returnType: &TypedType{
|
returnType: timestampType,
|
||||||
structName: "Timestamp",
|
|
||||||
packageName: "pcommon",
|
|
||||||
protoType: proto.TypeUint64,
|
|
||||||
defaultVal: "0",
|
|
||||||
testVal: "1234567890",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
&TypedField{
|
&TypedField{
|
||||||
fieldName: "Duration",
|
fieldName: "Duration",
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
|
@ -214,7 +215,7 @@ func SizeProtoOrigProfile(orig *otlpprofiles.Profile) int {
|
||||||
n += 1 + proto.Sov(uint64(l)) + l
|
n += 1 + proto.Sov(uint64(l)) + l
|
||||||
}
|
}
|
||||||
if orig.TimeUnixNano != 0 {
|
if orig.TimeUnixNano != 0 {
|
||||||
n += 1 + proto.Sov(uint64(orig.TimeUnixNano))
|
n += 9
|
||||||
}
|
}
|
||||||
if orig.DurationNano != 0 {
|
if orig.DurationNano != 0 {
|
||||||
n += 1 + proto.Sov(uint64(orig.DurationNano))
|
n += 1 + proto.Sov(uint64(orig.DurationNano))
|
||||||
|
|
@ -273,9 +274,10 @@ func MarshalProtoOrigProfile(orig *otlpprofiles.Profile, buf []byte) int {
|
||||||
buf[pos] = 0x12
|
buf[pos] = 0x12
|
||||||
}
|
}
|
||||||
if orig.TimeUnixNano != 0 {
|
if orig.TimeUnixNano != 0 {
|
||||||
pos = proto.EncodeVarint(buf, pos, uint64(orig.TimeUnixNano))
|
pos -= 8
|
||||||
|
binary.LittleEndian.PutUint64(buf[pos:], uint64(orig.TimeUnixNano))
|
||||||
pos--
|
pos--
|
||||||
buf[pos] = 0x18
|
buf[pos] = 0x19
|
||||||
}
|
}
|
||||||
if orig.DurationNano != 0 {
|
if orig.DurationNano != 0 {
|
||||||
pos = proto.EncodeVarint(buf, pos, uint64(orig.DurationNano))
|
pos = proto.EncodeVarint(buf, pos, uint64(orig.DurationNano))
|
||||||
|
|
@ -393,11 +395,11 @@ func UnmarshalProtoOrigProfile(orig *otlpprofiles.Profile, buf []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if wireType != proto.WireTypeVarint {
|
if wireType != proto.WireTypeI64 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field TimeUnixNano", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field TimeUnixNano", wireType)
|
||||||
}
|
}
|
||||||
var num uint64
|
var num uint64
|
||||||
num, pos, err = proto.ConsumeVarint(buf, pos)
|
num, pos, err = proto.ConsumeI64(buf, pos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ func genTestFailingUnmarshalProtoValuesProfile() map[string][]byte {
|
||||||
"Sample/wrong_wire_type": {0x14},
|
"Sample/wrong_wire_type": {0x14},
|
||||||
"Sample/missing_value": {0x12},
|
"Sample/missing_value": {0x12},
|
||||||
"TimeUnixNano/wrong_wire_type": {0x1c},
|
"TimeUnixNano/wrong_wire_type": {0x1c},
|
||||||
"TimeUnixNano/missing_value": {0x18},
|
"TimeUnixNano/missing_value": {0x19},
|
||||||
"DurationNano/wrong_wire_type": {0x24},
|
"DurationNano/wrong_wire_type": {0x24},
|
||||||
"DurationNano/missing_value": {0x20},
|
"DurationNano/missing_value": {0x20},
|
||||||
"PeriodType/wrong_wire_type": {0x2c},
|
"PeriodType/wrong_wire_type": {0x2c},
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,7 @@ func TestComponentInstrumentation(t *testing.T) {
|
||||||
"otelcol.receiver.produced.size": simpleMetric{
|
"otelcol.receiver.produced.size": simpleMetric{
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
||||||
): 1271,
|
): 1254,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
|
|
@ -570,12 +570,12 @@ func TestComponentInstrumentation(t *testing.T) {
|
||||||
"otelcol.processor.consumed.size": simpleMetric{
|
"otelcol.processor.consumed.size": simpleMetric{
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
||||||
): 1271,
|
): 1254,
|
||||||
},
|
},
|
||||||
"otelcol.processor.produced.size": simpleMetric{
|
"otelcol.processor.produced.size": simpleMetric{
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
||||||
): 1271,
|
): 1254,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
|
|
@ -602,17 +602,17 @@ func TestComponentInstrumentation(t *testing.T) {
|
||||||
"otelcol.connector.consumed.size": simpleMetric{
|
"otelcol.connector.consumed.size": simpleMetric{
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
||||||
): 1271,
|
): 1254,
|
||||||
},
|
},
|
||||||
"otelcol.connector.produced.size": simpleMetric{
|
"otelcol.connector.produced.size": simpleMetric{
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
||||||
attribute.String("otelcol.pipeline.id", "profiles/right"),
|
attribute.String("otelcol.pipeline.id", "profiles/right"),
|
||||||
): 668,
|
): 659,
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
||||||
attribute.String("otelcol.pipeline.id", "profiles/left"),
|
attribute.String("otelcol.pipeline.id", "profiles/left"),
|
||||||
): 603,
|
): 595,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
|
|
@ -628,7 +628,7 @@ func TestComponentInstrumentation(t *testing.T) {
|
||||||
"otelcol.exporter.consumed.size": simpleMetric{
|
"otelcol.exporter.consumed.size": simpleMetric{
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
||||||
): 668,
|
): 659,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
|
|
@ -644,7 +644,7 @@ func TestComponentInstrumentation(t *testing.T) {
|
||||||
"otelcol.exporter.consumed.size": simpleMetric{
|
"otelcol.exporter.consumed.size": simpleMetric{
|
||||||
attribute.NewSet(
|
attribute.NewSet(
|
||||||
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
attribute.String(obsconsumer.ComponentOutcome, "success"),
|
||||||
): 603,
|
): 595,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue