@@ -22,9 +22,8 @@ func TestMergeProfiles(t *testing.T) {
2222 pr2 := newProfilesRequest (testdata .GenerateProfiles (3 ))
2323 res , err := pr1 .MergeSplit (context .Background (), 0 , exporterhelper .RequestSizerTypeItems , pr2 )
2424 require .NoError (t , err )
25- assert .Len (t , res , 2 )
26- assert .Equal (t , 2 , res [0 ].ItemsCount ())
27- assert .Equal (t , 3 , res [1 ].ItemsCount ())
25+ assert .Len (t , res , 1 )
26+ assert .Equal (t , 5 , res [0 ].ItemsCount ())
2827}
2928
3029func TestMergeProfilesInvalidInput (t * testing.T ) {
@@ -34,8 +33,6 @@ func TestMergeProfilesInvalidInput(t *testing.T) {
3433}
3534
3635func TestMergeSplitProfiles (t * testing.T ) {
37- t .Skip ("merging of profiles has been temporarily disabled (https://github.com/open-telemetry/opentelemetry-collector/issues/13106)" )
38-
3936 tests := []struct {
4037 name string
4138 szt exporterhelper.RequestSizerType
@@ -53,12 +50,16 @@ func TestMergeSplitProfiles(t *testing.T) {
5350 expected : []Request {newProfilesRequest (pprofile .NewProfiles ())},
5451 },
5552 {
56- name : "first_request_empty" ,
57- szt : exporterhelper .RequestSizerTypeItems ,
58- maxSize : 10 ,
59- pr1 : newProfilesRequest (pprofile .NewProfiles ()),
60- pr2 : newProfilesRequest (testdata .GenerateProfiles (5 )),
61- expected : []Request {newProfilesRequest (testdata .GenerateProfiles (5 ))},
53+ name : "first_request_empty" ,
54+ szt : exporterhelper .RequestSizerTypeItems ,
55+ maxSize : 10 ,
56+ pr1 : newProfilesRequest (testdata .GenerateProfiles (0 )),
57+ pr2 : newProfilesRequest (testdata .GenerateProfiles (5 )),
58+ expected : []Request {newProfilesRequest (func () pprofile.Profiles {
59+ profiles := testdata .GenerateProfiles (0 )
60+ _ = testdata .GenerateProfiles (5 ).MergeTo (profiles )
61+ return profiles
62+ }())},
6263 },
6364 {
6465 name : "first_empty_second_nil" ,
@@ -137,8 +138,6 @@ func TestMergeSplitProfiles(t *testing.T) {
137138}
138139
139140func TestMergeSplitProfilesBasedOnByteSize (t * testing.T ) {
140- t .Skip ("merging of profiles has been temporarily disabled (https://github.com/open-telemetry/opentelemetry-collector/issues/13106)" )
141-
142141 tests := []struct {
143142 name string
144143 szt exporterhelper.RequestSizerType
@@ -253,7 +252,7 @@ func TestMergeSplitProfilesBasedOnByteSize(t *testing.T) {
253252 {
254253 name : "merge_only" ,
255254 szt : exporterhelper .RequestSizerTypeBytes ,
256- maxSize : profilesMarshaler .ProfilesSize (testdata .GenerateProfiles (11 )),
255+ maxSize : profilesMarshaler .ProfilesSize (testdata .GenerateProfiles (13 )),
257256 pr1 : newProfilesRequest (testdata .GenerateProfiles (4 )),
258257 pr2 : newProfilesRequest (testdata .GenerateProfiles (6 )),
259258 expected : []Request {newProfilesRequest (func () pprofile.Profiles {
@@ -266,12 +265,12 @@ func TestMergeSplitProfilesBasedOnByteSize(t *testing.T) {
266265 name : "split_only" ,
267266 szt : exporterhelper .RequestSizerTypeBytes ,
268267 maxSize : profilesMarshaler .ProfilesSize (testdata .GenerateProfiles (4 )),
269- pr1 : newProfilesRequest (pprofile . NewProfiles ( )),
268+ pr1 : newProfilesRequest (testdata . GenerateProfiles ( 0 )),
270269 pr2 : newProfilesRequest (testdata .GenerateProfiles (10 )),
271270 expected : []Request {
272271 newProfilesRequest (testdata .GenerateProfiles (4 )),
273- newProfilesRequest (testdata .GenerateProfiles (4 )),
274- newProfilesRequest (testdata .GenerateProfiles (2 )),
272+ newProfilesRequest (testdata .GenerateProfiles (5 )),
273+ newProfilesRequest (testdata .GenerateProfiles (1 )),
275274 },
276275 },
277276 {
@@ -283,11 +282,11 @@ func TestMergeSplitProfilesBasedOnByteSize(t *testing.T) {
283282 expected : []Request {
284283 newProfilesRequest (func () pprofile.Profiles {
285284 profiles := testdata .GenerateProfiles (7 )
286- testdata .GenerateProfiles (2 ).ResourceProfiles ().MoveAndAppendTo (profiles .ResourceProfiles ())
285+ testdata .GenerateProfiles (3 ).ResourceProfiles ().MoveAndAppendTo (profiles .ResourceProfiles ())
287286 return profiles
288287 }()),
289- newProfilesRequest (testdata .GenerateProfiles (10 )),
290- newProfilesRequest (testdata .GenerateProfiles (9 )),
288+ newProfilesRequest (testdata .GenerateProfiles (11 )),
289+ newProfilesRequest (testdata .GenerateProfiles (7 )),
291290 },
292291 },
293292 }
@@ -313,8 +312,6 @@ func TestExtractProfiles(t *testing.T) {
313312}
314313
315314func TestMergeSplitManySmallLogs (t * testing.T ) {
316- t .Skip ("merging of profiles has been temporarily disabled (https://github.com/open-telemetry/opentelemetry-collector/issues/13106)" )
317-
318315 // All requests merge into a single batch.
319316 merged := []Request {newProfilesRequest (testdata .GenerateProfiles (1 ))}
320317 for range 1000 {
@@ -326,8 +323,6 @@ func TestMergeSplitManySmallLogs(t *testing.T) {
326323}
327324
328325func BenchmarkSplittingBasedOnByteSizeManySmallProfiles (b * testing.B ) {
329- b .Skip ("merging of profiles has been temporarily disabled (https://github.com/open-telemetry/opentelemetry-collector/issues/13106)" )
330-
331326 // All requests merge into a single batch.
332327 b .ReportAllocs ()
333328 for b .Loop () {
@@ -342,13 +337,11 @@ func BenchmarkSplittingBasedOnByteSizeManySmallProfiles(b *testing.B) {
342337 )
343338 merged = append (merged [0 :len (merged )- 1 ], res ... )
344339 }
345- assert .Len (b , merged , 1 )
340+ assert .Len (b , merged , 2 )
346341 }
347342}
348343
349344func BenchmarkSplittingBasedOnByteSizeManyProfilesSlightlyAboveLimit (b * testing.B ) {
350- b .Skip ("merging of profiles has been temporarily disabled (https://github.com/open-telemetry/opentelemetry-collector/issues/13106)" )
351-
352345 // Every incoming request results in a split.
353346 b .ReportAllocs ()
354347 for b .Loop () {
@@ -369,8 +362,6 @@ func BenchmarkSplittingBasedOnByteSizeManyProfilesSlightlyAboveLimit(b *testing.
369362}
370363
371364func BenchmarkSplittingBasedOnByteSizeHugeProfiles (b * testing.B ) {
372- b .Skip ("merging of profiles has been temporarily disabled (https://github.com/open-telemetry/opentelemetry-collector/issues/13106)" )
373-
374365 // One request splits into many batches.
375366 b .ReportAllocs ()
376367 for b .Loop () {
0 commit comments