Skip to content

Commit

Permalink
Always overwrite event.Transaction.Message when isMessaging
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonip committed Jan 26, 2024
1 parent bd314dd commit bb8d9f9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions input/otlp/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ func TranslateTransaction(
)

var isHTTP, isRPC, isMessaging bool
var messagingQueueName string

var samplerType, samplerParam pcommon.Value
attributes.Range(func(kDots string, v pcommon.Value) bool {
Expand Down Expand Up @@ -410,11 +411,8 @@ func TranslateTransaction(

// messaging.*
case "message_bus.destination", semconv.AttributeMessagingDestination:
if event.Transaction.Message == nil {
event.Transaction.Message = modelpb.MessageFromVTPool()
}
event.Transaction.Message.QueueName = stringval
isMessaging = true
messagingQueueName = stringval
case semconv.AttributeMessagingSystem:
isMessaging = true
modelpb.Labels(event.Labels).Set(k, stringval)
Expand Down Expand Up @@ -502,6 +500,14 @@ func TranslateTransaction(
}
event.Url = modelpb.ParseURL(httpURL, httpHost, httpScheme)
}
if isMessaging {
// Overwrite existing event.Transaction.Message
event.Transaction.Message = nil
if messagingQueueName != "" {
event.Transaction.Message = modelpb.MessageFromVTPool()
event.Transaction.Message.QueueName = messagingQueueName
}
}

if event.Client == nil && event.Source != nil {
event.Client = modelpb.ClientFromVTPool()
Expand Down

0 comments on commit bb8d9f9

Please sign in to comment.