Skip to content

Commit

Permalink
[chore] [exporter/dataset] preallocate slice (#24935)
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Aug 7, 2023
1 parent a03ab67 commit 32e4da5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions exporter/datasetexporter/traces_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ type spanBundle struct {
}

func buildEventsFromTraces(ld ptrace.Traces, serverHost string) []*add_events.EventBundle {
var events []*add_events.EventBundle
var spans = make([]spanBundle, 0)

// convert spans into events
Expand All @@ -152,8 +151,9 @@ func buildEventsFromTraces(ld ptrace.Traces, serverHost string) []*add_events.Ev
}
}

for _, span := range spans {
events = append(events, buildEventFromSpan(span, serverHost))
events := make([]*add_events.EventBundle, len(spans))
for i, span := range spans {
events[i] = buildEventFromSpan(span, serverHost)
}

return events
Expand Down

0 comments on commit 32e4da5

Please sign in to comment.