Skip to content

Commit 00a5a09

Browse files
authored
[chore] [pkg/testdata] Fix profiles Sample transformation (#38448)
This is a fix for #38430 . It fixes adding sample locations to profiles. cc @atoulme
1 parent 31012ad commit 00a5a09

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/pdatatest/pprofiletest/types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ func (sa *Sample) Transform(pp pprofile.Profile) {
194194
panic("length of profile.sample_type must be equal to the length of sample.value")
195195
}
196196
psa := pp.Sample().AppendEmpty()
197-
psa.SetLocationsStartIndex(int32(pp.LocationTable().Len()))
197+
psa.SetLocationsStartIndex(int32(pp.LocationIndices().Len()))
198198
for _, loc := range sa.Locations {
199+
pp.LocationIndices().Append(int32(pp.LocationIndices().Len()))
199200
ploc := pp.LocationTable().AppendEmpty()
200201
if loc.Mapping != nil {
201202
loc.Mapping.Transform(pp)
@@ -212,7 +213,7 @@ func (sa *Sample) Transform(pp pprofile.Profile) {
212213
ploc.AttributeIndices().Append(at.Transform(pp))
213214
}
214215
}
215-
psa.SetLocationsLength(int32(pp.LocationTable().Len()) - psa.LocationsStartIndex())
216+
psa.SetLocationsLength(int32(pp.LocationIndices().Len()) - psa.LocationsStartIndex())
216217
psa.Value().FromRaw(sa.Value)
217218
for _, at := range sa.Attributes {
218219
psa.AttributeIndices().Append(at.Transform(pp))

0 commit comments

Comments
 (0)