Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix log event.parent_id from otlp span event #374

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion input/otlp/exceptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions input/otlp/test_approved/span_jaeger_http.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
},
"message": "baggage",
"parent": {
"id": "0000000058585858"
"id": "0000000041414646"
},
"service": {
"language": {
Expand Down Expand Up @@ -428,7 +428,7 @@
},
"message": "retrying connection",
"parent": {
"id": "0000000058585858"
"id": "0000000041414646"
},
"service": {
"language": {
Expand Down Expand Up @@ -474,7 +474,7 @@
"level": "error"
},
"parent": {
"id": "0000000058585858"
"id": "0000000041414646"
},
"service": {
"language": {
Expand Down
2 changes: 2 additions & 0 deletions input/otlp/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Loading