Skip to content

Commit

Permalink
fix: nil check trace id in rumv3 decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
kruskall committed Jun 15, 2023
1 parent f5f5a16 commit f7cf6ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion input/elasticapm/internal/modeldecoder/rumv3/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ func DecodeNestedTransaction(d decoder.Decoder, input *modeldecoder.Input, batch
spans := (*batch)[offset:]
for i, s := range root.Transaction.Spans {
if s.ParentIndex.IsSet() && s.ParentIndex.Val >= 0 && s.ParentIndex.Val < len(spans) {
spans[i].Parent.Id = spans[s.ParentIndex.Val].Span.Id
if e := spans[s.ParentIndex.Val]; e != nil {
if spans[i].Parent == nil {
spans[i].Parent = &modelpb.Parent{}
}
spans[i].Parent.Id = e.Span.Id
}
}
}
return nil
Expand Down

0 comments on commit f7cf6ee

Please sign in to comment.