Skip to content

Commit

Permalink
fix issues when processing single resource span traces or falling bac…
Browse files Browse the repository at this point in the history
…k to trace ID balancing
  • Loading branch information
zjanc committed Feb 24, 2023
1 parent e368114 commit aa77217
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions exporter/loadbalancingexporter/trace_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ func SplitTracesByResourceAttr(batches ptrace.Traces, attrKeys []string) (map[st
rss := batches.ResourceSpans()
lenRss := rss.Len()

if lenRss <= 1 {
return map[string][]ptrace.Traces{attrKeys[0]: {batches}}, nil
}

indicesByAttr := make(map[string]map[string][]int)
var fallbackIndices []int
var attrFound bool
Expand All @@ -118,7 +114,7 @@ func SplitTracesByResourceAttr(batches ptrace.Traces, attrKeys []string) (map[st

for j := 0; j < len(fallbackIndices); j++ {
t := ptrace.NewTraces()
rs := rss.At(j)
rs := rss.At(fallbackIndices[j])
rs.CopyTo(t.ResourceSpans().AppendEmpty())
nt := batchpersignal.SplitTraces(t)
result["traceId"] = append(result["traceId"], nt...)
Expand Down

0 comments on commit aa77217

Please sign in to comment.