@@ -413,17 +413,23 @@ func (c *Controller) fetchProjectsCiData(ctx context.Context, projectIds []int64
413413 return projectsCiData {}, err
414414 }
415415
416- traces , err := c .convertTraceSpans (pipelines , jobs , sections )
416+ traceData , err := c .convertTraceData (pipelines , jobs , sections )
417417 if err := handleError (err , "convert trace spans" ); err != nil {
418418 return projectsCiData {}, err
419419 }
420+ var traces []* typespb.Trace
421+ if len (traceData .ResourceSpans ) > 0 {
422+ traces = append (traces , & typespb.Trace {
423+ Data : traceData ,
424+ })
425+ }
420426
421427 return projectsCiData {
422428 Pipelines : pipelines ,
423429 Jobs : jobs ,
424430 Sections : sections ,
425431 Metrics : metrics ,
426- Traces : [] * typespb. Trace { traces } ,
432+ Traces : traces ,
427433 TestReports : testReports ,
428434 TestSuites : testSuites ,
429435 TestCases : testCases ,
@@ -528,7 +534,7 @@ func (c *Controller) exportProjectsCiData(ctx context.Context, data projectsCiDa
528534 return errs
529535}
530536
531- func (c * Controller ) convertTraceSpans (pipelines []types.Pipeline , jobs []types.Job , sections []types.Section ) (* typespb. Trace , error ) {
537+ func (c * Controller ) convertTraceData (pipelines []types.Pipeline , jobs []types.Job , sections []types.Section ) (* tracepb. TracesData , error ) {
532538 var (
533539 pipelineSpans []* tracepb.Span
534540 buildJobSpans []* tracepb.Span
@@ -600,11 +606,8 @@ func (c *Controller) convertTraceSpans(pipelines []types.Pipeline, jobs []types.
600606 )
601607 }
602608
603- traceData := & tracepb.TracesData {
609+ return & tracepb.TracesData {
604610 ResourceSpans : resourceSpans ,
605- }
606- return & typespb.Trace {
607- Data : traceData ,
608611 }, nil
609612}
610613
0 commit comments