Skip to content

Commit 52ee24d

Browse files
authored
[chore] pdata/pprofile: remove field Profile.StartTime (open-telemetry#41074)
This is the supporting change for open-telemetry/opentelemetry-collector#13315 where Profile.StartTime gets removed. <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Florian Lehner <[email protected]>
1 parent 34f72d1 commit 52ee24d

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

extension/encoding/otlpencodingextension/extension_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func generateProfiles() pprofile.Profiles {
202202
for i := 0; i < num; i++ {
203203
im := ilm.Profiles().AppendEmpty()
204204
im.SetProfileID([16]byte{0x01, 0x02, 0x03, 0x04})
205-
im.SetStartTime(pcommon.NewTimestampFromTime(now))
205+
im.SetTime(pcommon.NewTimestampFromTime(now))
206206
im.SetDuration(pcommon.NewTimestampFromTime(time.Now()))
207207
}
208208
return pd

internal/coreinternal/testdata/profile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func GenerateProfilesTwoProfilesSameResource() pprofile.Profiles {
4949
}
5050

5151
func fillProfileOne(dic pprofile.ProfilesDictionary, profile pprofile.Profile) {
52-
profile.SetStartTime(TestProfileStartTimestamp)
52+
profile.SetTime(TestProfileStartTimestamp)
5353
profile.SetProfileID([16]byte{0x01, 0x02, 0x03, 0x04})
5454

5555
profile.AttributeIndices().Append(0)
@@ -63,7 +63,7 @@ func fillProfileOne(dic pprofile.ProfilesDictionary, profile pprofile.Profile) {
6363
}
6464

6565
func fillProfileTwo(dic pprofile.ProfilesDictionary, profile pprofile.Profile) {
66-
profile.SetStartTime(TestProfileStartTimestamp)
66+
profile.SetTime(TestProfileStartTimestamp)
6767
profile.SetProfileID([16]byte{0x05, 0x06, 0x07, 0x08})
6868

6969
profile.AttributeIndices().Append(0)

pkg/pdatatest/pprofiletest/options.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (opt ignoreProfileTimestampValues) maskProfileTimestampValues(profiles ppro
128128
lrs := sls.At(j).Profiles()
129129
for k := 0; k < lrs.Len(); k++ {
130130
lr := lrs.At(k)
131-
lr.SetStartTime(pcommon.NewTimestampFromTime(time.Time{}))
131+
lr.SetTime(pcommon.NewTimestampFromTime(time.Time{}))
132132
lr.SetDuration(pcommon.NewTimestampFromTime(time.Time{}))
133133
}
134134
}
@@ -188,8 +188,8 @@ func sortProfileSlices(ls pprofile.Profiles) {
188188
for i := 0; i < ls.ResourceProfiles().Len(); i++ {
189189
for j := 0; j < ls.ResourceProfiles().At(i).ScopeProfiles().Len(); j++ {
190190
ls.ResourceProfiles().At(i).ScopeProfiles().At(j).Profiles().Sort(func(a, b pprofile.Profile) bool {
191-
if a.StartTime() != b.StartTime() {
192-
return a.StartTime() < b.StartTime()
191+
if a.Time() != b.Time() {
192+
return a.Time() < b.Time()
193193
}
194194
if a.Duration() != b.Duration() {
195195
return a.Duration() < b.Duration()

pkg/pdatatest/pprofiletest/profiles.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,6 @@ func CompareProfile(expectedDic, actualDic pprofile.ProfilesDictionary, expected
252252
errs = multierr.Append(errs, fmt.Errorf("profileID does not match expected '%s', actual '%s'", expected.ProfileID().String(), actual.ProfileID().String()))
253253
}
254254

255-
if expected.StartTime() != actual.StartTime() {
256-
errs = multierr.Append(errs, fmt.Errorf("start timestamp doesn't match expected: %d, "+"actual: %d", expected.StartTime(), actual.StartTime()))
257-
}
258-
259255
if !reflect.DeepEqual(expected.LocationIndices(), actual.LocationIndices()) {
260256
errs = multierr.Append(errs, errors.New("locationIndicies do not match expected"))
261257
}
@@ -276,10 +272,6 @@ func CompareProfile(expectedDic, actualDic pprofile.ProfilesDictionary, expected
276272
errs = multierr.Append(errs, fmt.Errorf("keepFrames does not match expected '%s', actual '%s'", expected.OriginalPayload().AsRaw(), actual.OriginalPayload().AsRaw()))
277273
}
278274

279-
if expected.StartTime() != actual.StartTime() {
280-
errs = multierr.Append(errs, fmt.Errorf("startTime doesn't match expected: %d, actual: %d", expected.StartTime(), actual.StartTime()))
281-
}
282-
283275
if expected.Duration() != actual.Duration() {
284276
errs = multierr.Append(errs, fmt.Errorf("duration doesn't match expected: %d, actual: %d", expected.Duration(), actual.Duration()))
285277
}

pkg/pdatatest/pprofiletest/profiles_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ func TestCompareProfiles(t *testing.T) {
327327
}
328328
return p.Transform()
329329
}(),
330-
withoutOptions: errors.New(`resource "map[key1:value1]": scope "scope1": profile "map[container-attr1:value1]": start timestamp doesn't match expected: 1577836800000000000, actual: 1577836805000000000; resource "map[key1:value1]": scope "scope1": profile "map[container-attr1:value1]": time doesn't match expected: 1577836800000000000, actual: 1577836805000000000; resource "map[key1:value1]": scope "scope1": profile "map[container-attr1:value1]": startTime doesn't match expected: 1577836800000000000, actual: 1577836805000000000`),
330+
withoutOptions: errors.New(`resource "map[key1:value1]": scope "scope1": profile "map[container-attr1:value1]": time doesn't match expected: 1577836800000000000, actual: 1577836805000000000`),
331331
compareOptions: []CompareProfilesOption{
332332
IgnoreProfileTimestampValues(),
333333
},

0 commit comments

Comments
 (0)