diff --git a/input/otlp/exceptions_test.go b/input/otlp/exceptions_test.go index f15193fc..e73bf25c 100644 --- a/input/otlp/exceptions_test.go +++ b/input/otlp/exceptions_test.go @@ -60,10 +60,12 @@ func TestEncodeSpanEventsNonExceptions(t *testing.T) { semconv.AttributeExceptionStacktrace, "stacktrace", ) - _, events := transformTransactionSpanEvents(t, "java", nonExceptionEvent, incompleteExceptionEvent) + transactionEvent, events := transformTransactionSpanEvents(t, "java", nonExceptionEvent, incompleteExceptionEvent) require.Len(t, events, 2) assert.Equal(t, modelpb.LogEventType, events[0].Type()) + assert.Equal(t, transactionEvent.Transaction.Id, events[0].ParentId) assert.Equal(t, modelpb.LogEventType, events[1].Type()) + assert.Equal(t, transactionEvent.Transaction.Id, events[1].ParentId) } func TestEncodeSpanEventsJavaExceptions(t *testing.T) { diff --git a/input/otlp/traces.go b/input/otlp/traces.go index a996a8f7..664df40d 100644 --- a/input/otlp/traces.go +++ b/input/otlp/traces.go @@ -1265,10 +1265,12 @@ func setLogContext(out *modelpb.APMEvent, parent *modelpb.APMEvent) { out.Transaction.Id = parent.Transaction.Id out.Span = &modelpb.Span{} out.Span.Id = parent.Transaction.Id + out.ParentId = parent.Transaction.Id } if parent.Span != nil { out.Span = &modelpb.Span{} out.Span.Id = parent.Span.Id + out.ParentId = parent.Span.Id } }