Skip to content

Commit

Permalink
Remove parent.id from span event logs
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonip committed Oct 1, 2024
1 parent 2d857c2 commit 61019c6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
4 changes: 1 addition & 3 deletions input/otlp/exceptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,10 @@ func TestEncodeSpanEventsNonExceptions(t *testing.T) {
semconv.AttributeExceptionStacktrace, "stacktrace",
)

transactionEvent, events := transformTransactionSpanEvents(t, "java", nonExceptionEvent, incompleteExceptionEvent)
_, 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
9 changes: 0 additions & 9 deletions input/otlp/test_approved/span_jaeger_http.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,6 @@
"isValid": "false"
},
"message": "baggage",
"parent": {
"id": "0000000041414646"
},
"service": {
"language": {
"name": "unknown"
Expand Down Expand Up @@ -427,9 +424,6 @@
"level": "info"
},
"message": "retrying connection",
"parent": {
"id": "0000000041414646"
},
"service": {
"language": {
"name": "unknown"
Expand Down Expand Up @@ -473,9 +467,6 @@
"labels": {
"level": "error"
},
"parent": {
"id": "0000000041414646"
},
"service": {
"language": {
"name": "unknown"
Expand Down
3 changes: 1 addition & 2 deletions input/otlp/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,7 @@ func (c *Consumer) convertSpanEvent(
initEventLabels(event)
event.Transaction = nil // populate fields as required from parent
event.Span = nil // populate fields as required from parent
event.ParentId = "" // populate fields as required from parent
event.Timestamp = modelpb.FromTime(spanEvent.Timestamp().AsTime().Add(timeDelta))

isJaeger := strings.HasPrefix(parent.Agent.Name, "Jaeger")
Expand Down Expand Up @@ -1265,12 +1266,10 @@ 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

0 comments on commit 61019c6

Please sign in to comment.