Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade pdata to v1.5.0 #11932

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
25 changes: 25 additions & 0 deletions .chloggen/pdata-1-5-0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: pdata

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Upgrade pdata to opentelemetry-proto v1.5.0

# One or more tracking issues or pull requests related to the change
issues: [11932]

# (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.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/profiles-pdata-1-5-0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: pdata/pprofile

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove duplicate Attributes field from profile

# One or more tracking issues or pull requests related to the change
issues: [11932]

# (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.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ ocb:
OPENTELEMETRY_PROTO_SRC_DIR=pdata/internal/opentelemetry-proto

# The branch matching the current version of the proto to use
OPENTELEMETRY_PROTO_VERSION=v1.4.0
OPENTELEMETRY_PROTO_VERSION=v1.5.0

# Find all .proto files.
OPENTELEMETRY_PROTO_FILES := $(subst $(OPENTELEMETRY_PROTO_SRC_DIR)/,,$(wildcard $(OPENTELEMETRY_PROTO_SRC_DIR)/opentelemetry/proto/*/v1/*.proto $(OPENTELEMETRY_PROTO_SRC_DIR)/opentelemetry/proto/collector/*/v1/*.proto $(OPENTELEMETRY_PROTO_SRC_DIR)/opentelemetry/proto/*/v1development/*.proto $(OPENTELEMETRY_PROTO_SRC_DIR)/opentelemetry/proto/collector/*/v1development/*.proto))
Expand Down
12 changes: 9 additions & 3 deletions exporter/debugexporter/internal/normal/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package normal // import "go.opentelemetry.io/collector/exporter/debugexporter/i

import (
"bytes"
"fmt"
"strconv"
"strings"

Expand Down Expand Up @@ -35,10 +36,15 @@ func (normalProfilesMarshaler) MarshalProfiles(pd pprofile.Profiles) ([]byte, er
buffer.WriteString(" samples=")
buffer.WriteString(strconv.Itoa(profile.Sample().Len()))

if profile.Attributes().Len() > 0 {
profileAttributes := writeAttributes(profile.Attributes())
if profile.AttributeIndices().Len() > 0 {
attrs := []string{}
for _, i := range profile.AttributeIndices().AsRaw() {
a := profile.AttributeTable().At(int(i))
attrs = append(attrs, fmt.Sprintf("%s=%s", a.Key(), a.Value().AsString()))
dmathieu marked this conversation as resolved.
Show resolved Hide resolved
dmathieu marked this conversation as resolved.
Show resolved Hide resolved
dmathieu marked this conversation as resolved.
Show resolved Hide resolved
}

buffer.WriteString(" ")
buffer.WriteString(strings.Join(profileAttributes, " "))
buffer.WriteString(strings.Join(attrs, " "))
}

buffer.WriteString("\n")
Expand Down
5 changes: 4 additions & 1 deletion exporter/debugexporter/internal/normal/profiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func TestMarshalProfiles(t *testing.T) {
profile.SetProfileID([16]byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10})
profile.Sample().AppendEmpty()
profile.Sample().AppendEmpty()
profile.Attributes().PutStr("key1", "value1")
profile.AttributeIndices().Append(0)
a := profile.AttributeTable().AppendEmpty()
a.SetKey("key1")
a.Value().SetStr("value1")
return profiles
}(),
expected: `0102030405060708090a0b0c0d0e0f10 samples=2 key1=value1
Expand Down
1 change: 0 additions & 1 deletion exporter/debugexporter/internal/otlptext/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func (textProfilesMarshaler) MarshalProfiles(pd pprofile.Profiles) ([]byte, erro
buf.logAttr("Profile ID", profile.ProfileID())
buf.logAttr("Start time", profile.Time().String())
buf.logAttr("Duration", profile.Duration().String())
buf.logAttributes("Attributes", profile.Attributes())
buf.logAttr("Dropped attributes count", strconv.FormatUint(uint64(profile.DroppedAttributesCount()), 10))
buf.logEntry(" Location indices: %d", profile.LocationIndices().AsRaw())

Expand Down
6 changes: 6 additions & 0 deletions pdata/internal/cmd/pdatagen/internal/plog_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ var logRecord = &messageValueStruct{
testVal: "1",
},
},
&primitiveField{
fieldName: "EventName",
returnType: "string",
defaultVal: `""`,
testVal: `""`,
},
&primitiveField{
fieldName: "SeverityText",
returnType: "string",
Expand Down
4 changes: 2 additions & 2 deletions pdata/internal/cmd/pdatagen/internal/pprofile_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ var profile = &messageValueStruct{
},
},
&sliceField{
fieldName: "Attributes",
returnSlice: mapStruct,
fieldName: "AttributeIndices",
returnSlice: int32Slice,
},
droppedAttributesCount,
&primitiveField{
Expand Down
Loading
Loading