Skip to content

Commit

Permalink
fix(testutil): fix tracing span collection (#324)
Browse files Browse the repository at this point in the history
collect all spans if export spans is called more than once
  • Loading branch information
hannahhoward committed Jan 4, 2022
1 parent e31bcd3 commit 8e9f6cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion testutil/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Collector struct {

// ExportSpans receives the ReadOnlySpans from the batch provider
func (c *Collector) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error {
c.Spans = tracetest.SpanStubsFromReadOnlySpans(spans)
c.Spans = append(c.Spans, tracetest.SpanStubsFromReadOnlySpans(spans)...)
sort.SliceStable(c.Spans, func(i, j int) bool {
return c.Spans[i].StartTime.Before(c.Spans[j].StartTime)
})
Expand Down

0 comments on commit 8e9f6cf

Please sign in to comment.