From 13424594ed553170b94648215daf4dff3b137b96 Mon Sep 17 00:00:00 2001 From: Zhou Date: Mon, 2 Dec 2024 10:31:51 -0800 Subject: [PATCH] Generate url section in xray segment when net.peer.name is available --- exporter/awsxrayexporter/internal/translator/http.go | 1 + exporter/awsxrayexporter/internal/translator/http_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/exporter/awsxrayexporter/internal/translator/http.go b/exporter/awsxrayexporter/internal/translator/http.go index f1f135dafe62..7aa31f83b777 100644 --- a/exporter/awsxrayexporter/internal/translator/http.go +++ b/exporter/awsxrayexporter/internal/translator/http.go @@ -92,6 +92,7 @@ func makeHTTP(span ptrace.Span) (map[string]pcommon.Value, *awsxray.HTTPData) { hasHTTPRequestURLAttributes = true case conventions.AttributeNetPeerName: urlParts[key] = value.Str() + hasHTTPRequestURLAttributes = true case conventions.AttributeNetPeerPort: urlParts[key] = value.Str() if len(urlParts[key]) == 0 { diff --git a/exporter/awsxrayexporter/internal/translator/http_test.go b/exporter/awsxrayexporter/internal/translator/http_test.go index 0c5ff1b9983f..a5fd43109ac8 100644 --- a/exporter/awsxrayexporter/internal/translator/http_test.go +++ b/exporter/awsxrayexporter/internal/translator/http_test.go @@ -88,6 +88,7 @@ func TestClientSpanWithPeerAttributes(t *testing.T) { assert.NotNil(t, httpData) assert.NotNil(t, filtered) + assert.NotNil(t, httpData.Request.URL) assert.Equal(t, "10.8.17.36", *httpData.Request.ClientIP)