Skip to content

Commit 1e18650

Browse files
committed
fix pkg/golden
1 parent 8937988 commit 1e18650

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

pkg/golden/golden_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,25 +368,26 @@ func TestProfilesRoundTrip(t *testing.T) {
368368

369369
func CreateTestProfiles() pprofile.Profiles {
370370
profiles := pprofile.NewProfiles()
371+
dic := profiles.ProfilesDictionary()
371372
resource := profiles.ResourceProfiles().AppendEmpty()
372373
scope := resource.ScopeProfiles().AppendEmpty()
373374
profile := scope.Profiles().AppendEmpty()
374375

375-
profile.StringTable().Append("samples", "count", "cpu", "nanoseconds")
376+
dic.StringTable().Append("samples", "count", "cpu", "nanoseconds")
376377
st := profile.SampleType().AppendEmpty()
377378
st.SetTypeStrindex(0)
378379
st.SetUnitStrindex(1)
379380
pt := profile.PeriodType()
380381
pt.SetTypeStrindex(2)
381382
pt.SetUnitStrindex(3)
382383

383-
a := profile.AttributeTable().AppendEmpty()
384+
a := dic.AttributeTable().AppendEmpty()
384385
a.SetKey("process.executable.build_id.htlhash")
385386
a.Value().SetStr("600DCAFE4A110000F2BF38C493F5FB92")
386-
a = profile.AttributeTable().AppendEmpty()
387+
a = dic.AttributeTable().AppendEmpty()
387388
a.SetKey("profile.frame.type")
388389
a.Value().SetStr("native")
389-
a = profile.AttributeTable().AppendEmpty()
390+
a = dic.AttributeTable().AppendEmpty()
390391
a.SetKey("host.id")
391392
a.Value().SetStr("localhost")
392393

@@ -396,10 +397,10 @@ func CreateTestProfiles() pprofile.Profiles {
396397
sample.TimestampsUnixNano().Append(0)
397398
sample.SetLocationsLength(1)
398399

399-
m := profile.MappingTable().AppendEmpty()
400+
m := dic.MappingTable().AppendEmpty()
400401
m.AttributeIndices().Append(0)
401402

402-
l := profile.LocationTable().AppendEmpty()
403+
l := dic.LocationTable().AppendEmpty()
403404
l.SetMappingIndex(0)
404405
l.SetAddress(111)
405406
l.AttributeIndices().Append(1)
Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
1+
dictionary:
2+
attributeTable:
3+
- key: process.executable.build_id.htlhash
4+
value:
5+
stringValue: 600DCAFE4A110000F2BF38C493F5FB92
6+
- key: profile.frame.type
7+
value:
8+
stringValue: native
9+
- key: host.id
10+
value:
11+
stringValue: localhost
12+
locationTable:
13+
- address: "111"
14+
attributeIndices:
15+
- 1
16+
mappingIndex: 0
17+
mappingTable:
18+
- attributeIndices:
19+
- 0
20+
stringTable:
21+
- samples
22+
- count
23+
- cpu
24+
- nanoseconds
125
resourceProfiles:
226
- resource: {}
327
scopeProfiles:
428
- profiles:
529
- attributeIndices:
630
- 2
7-
attributeTable:
8-
- key: process.executable.build_id.htlhash
9-
value:
10-
stringValue: 600DCAFE4A110000F2BF38C493F5FB92
11-
- key: profile.frame.type
12-
value:
13-
stringValue: native
14-
- key: host.id
15-
value:
16-
stringValue: localhost
17-
locationTable:
18-
- address: "111"
19-
attributeIndices:
20-
- 1
21-
mappingIndex: 0
22-
mappingTable:
23-
- attributeIndices:
24-
- 0
2531
periodType:
2632
typeStrindex: 2
2733
unitStrindex: 3
@@ -32,9 +38,4 @@ resourceProfiles:
3238
- "0"
3339
sampleType:
3440
- unitStrindex: 1
35-
stringTable:
36-
- samples
37-
- count
38-
- cpu
39-
- nanoseconds
4041
scope: {}

0 commit comments

Comments
 (0)