Skip to content

Commit

Permalink
add namespace to server and peer name across namespaces (#1247)
Browse files Browse the repository at this point in the history
  • Loading branch information
esara authored Oct 31, 2024
1 parent bce5cf4 commit 882ccc2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/export/otel/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,17 @@ func (tr *tracesOTELReceiver) acceptSpan(span *request.Span) bool {
func traceAttributes(span *request.Span, optionalAttrs map[attr.Name]struct{}) []attribute.KeyValue {
var attrs []attribute.KeyValue

// add namespace to server and peer name across namespaces
if span.OtherNamespace != "" && span.OtherNamespace != span.ServiceID.Namespace &&
// in Kafka events we never get the client, so we hijack the OtherNamespace for the clientId
span.Type != request.EventTypeKafkaServer && span.Type != request.EventTypeKafkaClient {
if span.IsClientSpan() {
span.HostName = request.SpanHost(span) + "." + span.OtherNamespace
} else {
span.PeerName = request.SpanPeer(span) + "." + span.OtherNamespace
}
}

switch span.Type {
case request.EventTypeHTTP:
attrs = []attribute.KeyValue{
Expand Down

0 comments on commit 882ccc2

Please sign in to comment.