Skip to content

Commit c2224e6

Browse files
[chore] Fix BenchmarkProfilesUsage (#14215)
#### Description The `Duration` and `SetDuration` methods were deprecated in #14188, and their implementations are now no-ops, causing [a benchmark to fail](https://github.com/open-telemetry/opentelemetry-collector/actions/runs/19668308741/job/56330560134). I updated the benchmark to use `DurationNano` and `SetDurationNano` instead.
1 parent 482651b commit c2224e6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pdata/pprofile/profiles_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ func TestProfilesSwitchDictionary(t *testing.T) {
171171
func BenchmarkProfilesUsage(b *testing.B) {
172172
pd := generateTestProfiles()
173173
ts := pcommon.NewTimestampFromTime(time.Now())
174+
dur := uint64(1_000_000_000)
174175
testValProfileID := ProfileID([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1})
175176
testSecondValProfileID := ProfileID([16]byte{2, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1})
176177

@@ -197,13 +198,13 @@ func BenchmarkProfilesUsage(b *testing.B) {
197198
assert.Equal(b, testValProfileID, s.ProfileID())
198199
s.SetTime(ts)
199200
assert.Equal(b, ts, s.Time())
200-
s.SetDuration(ts)
201-
assert.Equal(b, ts, s.Duration())
201+
s.SetDurationNano(dur)
202+
assert.Equal(b, dur, s.DurationNano())
202203
}
203204
s := iss.Profiles().AppendEmpty()
204205
s.SetProfileID(testSecondValProfileID)
205206
s.SetTime(ts)
206-
s.SetDuration(ts)
207+
s.SetDurationNano(dur)
207208
s.AttributeIndices().Append(1)
208209
iss.Profiles().RemoveIf(func(lr Profile) bool {
209210
return lr.ProfileID() == testSecondValProfileID

0 commit comments

Comments
 (0)