Skip to content

Commit 6ab342d

Browse files
fix issue to not set url.full attribute
Signed-off-by: Shi, Stone <[email protected]>
1 parent 60fb936 commit 6ab342d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,10 @@ def collect_request_attributes(
354354
result, path, path, query_string, sem_conv_opt_in_mode
355355
)
356356
if http_url:
357-
_set_http_url(
358-
result, remove_url_credentials(http_url), sem_conv_opt_in_mode
359-
)
357+
if _report_old(sem_conv_opt_in_mode) or (sem_conv_opt_in_mode == _HTTPStabilityMode.HTTP_DUP):
358+
_set_http_url(
359+
result, remove_url_credentials(http_url), sem_conv_opt_in_mode
360+
)
360361

361362
http_method = scope.get("method", "")
362363
if http_method:

Diff for: instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py

-5
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ def validate_outputs(
410410
SERVER_ADDRESS: "127.0.0.1",
411411
NETWORK_PROTOCOL_VERSION: "1.0",
412412
URL_PATH: "/",
413-
URL_FULL: "http://127.0.0.1/",
414413
CLIENT_ADDRESS: "127.0.0.1",
415414
CLIENT_PORT: 32767,
416415
HTTP_RESPONSE_STATUS_CODE: 200,
@@ -691,7 +690,6 @@ def update_expected_server(expected):
691690
{
692691
SERVER_ADDRESS: "0.0.0.0",
693692
SERVER_PORT: 80,
694-
URL_FULL: "http://0.0.0.0/",
695693
}
696694
)
697695
return expected
@@ -1007,7 +1005,6 @@ def test_websocket_new_semconv(self):
10071005
SERVER_ADDRESS: self.scope["server"][0],
10081006
NETWORK_PROTOCOL_VERSION: self.scope["http_version"],
10091007
URL_PATH: self.scope["path"],
1010-
URL_FULL: f'{self.scope["scheme"]}://{self.scope["server"][0]}{self.scope["path"]}',
10111008
CLIENT_ADDRESS: self.scope["client"][0],
10121009
CLIENT_PORT: self.scope["client"][1],
10131010
HTTP_RESPONSE_STATUS_CODE: 200,
@@ -1578,7 +1575,6 @@ def test_request_attributes_new_semconv(self):
15781575
SERVER_ADDRESS: "127.0.0.1",
15791576
URL_PATH: "/",
15801577
URL_QUERY: "foo=bar",
1581-
URL_FULL: "http://127.0.0.1/?foo=bar",
15821578
SERVER_PORT: 80,
15831579
URL_SCHEME: "http",
15841580
NETWORK_PROTOCOL_VERSION: "1.0",
@@ -1637,7 +1633,6 @@ def test_query_string_new_semconv(self):
16371633
self.scope,
16381634
_HTTPStabilityMode.HTTP,
16391635
)
1640-
self.assertEqual(attrs[URL_FULL], "http://127.0.0.1/?foo=bar")
16411636

16421637
def test_query_string_both_semconv(self):
16431638
self.scope["query_string"] = b"foo=bar"

0 commit comments

Comments
 (0)