Skip to content

Commit

Permalink
Use slices of pointers in pprofile (open-telemetry#11339)
Browse files Browse the repository at this point in the history
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

All these slices of values have a potential to store large amounts of
data, and should therefore be slices of pointers.

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes open-telemetry#11281

cc @mx-psi @bogdandrutu
  • Loading branch information
dmathieu authored and HongChenTW committed Dec 19, 2024
1 parent 71b3728 commit 189ead7
Show file tree
Hide file tree
Showing 23 changed files with 574 additions and 284 deletions.
20 changes: 20 additions & 0 deletions .chloggen/pprofile-slice-ptrs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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: Replace slices of values to slices of pointers for the `Mapping`, `Location`, `Line`, `Function`, `AttributeUnit`, `Link`, `Value`, `Sample` and `Labels` attributes.

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

# 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]
18 changes: 9 additions & 9 deletions pdata/internal/cmd/pdatagen/internal/pprofile_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ var profile = &messageValueStruct{
},
}

var valueTypeSlice = &sliceOfValues{
var valueTypeSlice = &sliceOfPtrs{
structName: "ValueTypeSlice",
element: valueType,
}
Expand Down Expand Up @@ -261,7 +261,7 @@ var valueType = &messageValueStruct{
},
}

var sampleSlice = &sliceOfValues{
var sampleSlice = &sliceOfPtrs{
structName: "SampleSlice",
element: sample,
}
Expand Down Expand Up @@ -318,7 +318,7 @@ var sample = &messageValueStruct{
},
}

var labelSlice = &sliceOfValues{
var labelSlice = &sliceOfPtrs{
structName: "LabelSlice",
element: label,
}
Expand Down Expand Up @@ -355,7 +355,7 @@ var label = &messageValueStruct{
},
}

var mappingSlice = &sliceOfValues{
var mappingSlice = &sliceOfPtrs{
structName: "MappingSlice",
element: mapping,
}
Expand Down Expand Up @@ -441,7 +441,7 @@ var mapping = &messageValueStruct{
},
}

var locationSlice = &sliceOfValues{
var locationSlice = &sliceOfPtrs{
structName: "LocationSlice",
element: location,
}
Expand Down Expand Up @@ -492,7 +492,7 @@ var location = &messageValueStruct{
},
}

var lineSlice = &sliceOfValues{
var lineSlice = &sliceOfPtrs{
structName: "LineSlice",
element: line,
}
Expand Down Expand Up @@ -523,7 +523,7 @@ var line = &messageValueStruct{
},
}

var functionSlice = &sliceOfValues{
var functionSlice = &sliceOfPtrs{
structName: "FunctionSlice",
element: function,
}
Expand Down Expand Up @@ -567,7 +567,7 @@ var function = &messageValueStruct{
},
}

var attributeUnitSlice = &sliceOfValues{
var attributeUnitSlice = &sliceOfPtrs{
structName: "AttributeUnitSlice",
element: attributeUnit,
}
Expand All @@ -592,7 +592,7 @@ var attributeUnit = &messageValueStruct{
},
}

var linkSlice = &sliceOfValues{
var linkSlice = &sliceOfPtrs{
structName: "LinkSlice",
element: link,
}
Expand Down
242 changes: 121 additions & 121 deletions pdata/internal/data/protogen/profiles/v1experimental/pprofextended.pb.go

Large diffs are not rendered by default.

34 changes: 25 additions & 9 deletions pdata/pprofile/generated_attributeunitslice.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 22 additions & 5 deletions pdata/pprofile/generated_attributeunitslice_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 25 additions & 9 deletions pdata/pprofile/generated_functionslice.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 22 additions & 5 deletions pdata/pprofile/generated_functionslice_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 189ead7

Please sign in to comment.