diff --git a/pkg/transform/name_resolver.go b/pkg/transform/name_resolver.go index 1fdfb479b..64495c3d8 100644 --- a/pkg/transform/name_resolver.go +++ b/pkg/transform/name_resolver.go @@ -125,9 +125,15 @@ func (nr *NameResolver) resolveNames(span *request.Span) { // in a previous stage (e.g. Kubernetes decorator) if pn != "" { span.PeerName = pn + if span.OtherNamespace != "" { + span.PeerName = pn + "." + span.OtherNamespace + } } if hn != "" { span.HostName = hn + if span.OtherNamespace != "" { + span.HostName = hn + "." + span.OtherNamespace + } } } diff --git a/pkg/transform/name_resolver_test.go b/pkg/transform/name_resolver_test.go index 1fcb3bae2..f58b53b4c 100644 --- a/pkg/transform/name_resolver_test.go +++ b/pkg/transform/name_resolver_test.go @@ -90,9 +90,9 @@ func TestResolvePodsFromK8s(t *testing.T) { nr.resolveNames(&clientSpan) - assert.Equal(t, "pod1", clientSpan.PeerName) + assert.Equal(t, "pod1.something", clientSpan.PeerName) assert.Equal(t, "", clientSpan.ServiceID.Namespace) - assert.Equal(t, "pod2", clientSpan.HostName) + assert.Equal(t, "pod2.something", clientSpan.HostName) assert.Equal(t, "something", clientSpan.OtherNamespace) nr.resolveNames(&serverSpan) @@ -161,9 +161,9 @@ func TestResolveServiceFromK8s(t *testing.T) { nr.resolveNames(&clientSpan) - assert.Equal(t, "pod1", clientSpan.PeerName) + assert.Equal(t, "pod1.something", clientSpan.PeerName) assert.Equal(t, "", clientSpan.ServiceID.Namespace) - assert.Equal(t, "pod2", clientSpan.HostName) + assert.Equal(t, "pod2.something", clientSpan.HostName) assert.Equal(t, "something", clientSpan.OtherNamespace) nr.resolveNames(&serverSpan) @@ -251,9 +251,9 @@ func TestResolveNodesFromK8s(t *testing.T) { nr.resolveNames(&clientSpan) - assert.Equal(t, "node1", clientSpan.PeerName) + assert.Equal(t, "node1.something", clientSpan.PeerName) assert.Equal(t, "", clientSpan.ServiceID.Namespace) - assert.Equal(t, "node2", clientSpan.HostName) + assert.Equal(t, "node2.something", clientSpan.HostName) assert.Equal(t, "something", clientSpan.OtherNamespace) nr.resolveNames(&serverSpan)