5252from opentelemetry .semconv .attributes .network_attributes import (
5353 NETWORK_PROTOCOL_VERSION ,
5454)
55- from opentelemetry .semconv .attributes .server_attributes import SERVER_PORT
55+ from opentelemetry .semconv .attributes .server_attributes import (
56+ SERVER_ADDRESS ,
57+ SERVER_PORT ,
58+ )
5659from opentelemetry .semconv .attributes .url_attributes import (
5760 URL_PATH ,
5861 URL_QUERY ,
@@ -401,6 +404,7 @@ def validate_outputs(
401404 "attributes" : {
402405 HTTP_REQUEST_METHOD : "GET" ,
403406 URL_SCHEME : "http" ,
407+ SERVER_ADDRESS : "127.0.0.1" ,
404408 SERVER_PORT : 80 ,
405409 NETWORK_PROTOCOL_VERSION : "1.0" ,
406410 URL_PATH : "/" ,
@@ -436,6 +440,7 @@ def validate_outputs(
436440 "attributes" : {
437441 HTTP_REQUEST_METHOD : "GET" ,
438442 URL_SCHEME : "http" ,
443+ SERVER_ADDRESS : "127.0.0.1" ,
439444 SERVER_PORT : 80 ,
440445 NETWORK_PROTOCOL_VERSION : "1.0" ,
441446 URL_PATH : "/" ,
@@ -706,7 +711,7 @@ async def test_behavior_with_scope_server_as_none_new_semconv(self):
706711 def update_expected_server (expected ):
707712 expected [3 ]["attributes" ].update (
708713 {
709- CLIENT_ADDRESS : "0.0.0.0" ,
714+ SERVER_ADDRESS : "0.0.0.0" ,
710715 SERVER_PORT : 80 ,
711716 }
712717 )
@@ -733,7 +738,7 @@ def update_expected_server(expected):
733738 SpanAttributes .HTTP_HOST : "0.0.0.0" ,
734739 SpanAttributes .NET_HOST_PORT : 80 ,
735740 SpanAttributes .HTTP_URL : "http://0.0.0.0/" ,
736- CLIENT_ADDRESS : "0.0.0.0" ,
741+ SERVER_ADDRESS : "0.0.0.0" ,
737742 SERVER_PORT : 80 ,
738743 }
739744 )
@@ -948,7 +953,7 @@ async def test_websocket(self):
948953 SpanAttributes .HTTP_HOST : self .scope ["server" ][0 ],
949954 SpanAttributes .HTTP_FLAVOR : self .scope ["http_version" ],
950955 SpanAttributes .HTTP_TARGET : self .scope ["path" ],
951- SpanAttributes .HTTP_URL : f' { self .scope [" scheme" ]} ://{ self .scope [" server" ][0 ]} { self .scope [" path" ] } ' ,
956+ SpanAttributes .HTTP_URL : f" { self .scope [' scheme' ]} ://{ self .scope [' server' ][0 ]} { self .scope [' path' ] } " ,
952957 SpanAttributes .NET_PEER_IP : self .scope ["client" ][0 ],
953958 SpanAttributes .NET_PEER_PORT : self .scope ["client" ][1 ],
954959 SpanAttributes .HTTP_STATUS_CODE : 200 ,
@@ -1018,6 +1023,7 @@ async def test_websocket_new_semconv(self):
10181023 "kind" : trace_api .SpanKind .SERVER ,
10191024 "attributes" : {
10201025 URL_SCHEME : self .scope ["scheme" ],
1026+ SERVER_ADDRESS : self .scope ["server" ][0 ],
10211027 SERVER_PORT : self .scope ["server" ][1 ],
10221028 NETWORK_PROTOCOL_VERSION : self .scope ["http_version" ],
10231029 URL_PATH : self .scope ["path" ],
@@ -1096,12 +1102,13 @@ async def test_websocket_both_semconv(self):
10961102 SpanAttributes .HTTP_HOST : self .scope ["server" ][0 ],
10971103 SpanAttributes .HTTP_FLAVOR : self .scope ["http_version" ],
10981104 SpanAttributes .HTTP_TARGET : self .scope ["path" ],
1099- SpanAttributes .HTTP_URL : f' { self .scope [" scheme" ]} ://{ self .scope [" server" ][0 ]} { self .scope [" path" ] } ' ,
1105+ SpanAttributes .HTTP_URL : f" { self .scope [' scheme' ]} ://{ self .scope [' server' ][0 ]} { self .scope [' path' ] } " ,
11001106 SpanAttributes .NET_PEER_IP : self .scope ["client" ][0 ],
11011107 SpanAttributes .NET_PEER_PORT : self .scope ["client" ][1 ],
11021108 SpanAttributes .HTTP_STATUS_CODE : 200 ,
11031109 SpanAttributes .HTTP_METHOD : self .scope ["method" ],
11041110 URL_SCHEME : self .scope ["scheme" ],
1111+ SERVER_ADDRESS : self .scope ["server" ][0 ],
11051112 SERVER_PORT : self .scope ["server" ][1 ],
11061113 NETWORK_PROTOCOL_VERSION : self .scope ["http_version" ],
11071114 URL_PATH : self .scope ["path" ],
@@ -1661,6 +1668,7 @@ def test_request_attributes_new_semconv(self):
16611668 HTTP_REQUEST_METHOD : "GET" ,
16621669 URL_PATH : "/" ,
16631670 URL_QUERY : "foo=bar" ,
1671+ SERVER_ADDRESS : "127.0.0.1" ,
16641672 SERVER_PORT : 80 ,
16651673 URL_SCHEME : "http" ,
16661674 NETWORK_PROTOCOL_VERSION : "1.0" ,
@@ -1696,6 +1704,7 @@ def test_request_attributes_both_semconv(self):
16961704 HTTP_REQUEST_METHOD : "GET" ,
16971705 URL_PATH : "/" ,
16981706 URL_QUERY : "foo=bar" ,
1707+ SERVER_ADDRESS : "127.0.0.1" ,
16991708 SERVER_PORT : 80 ,
17001709 URL_SCHEME : "http" ,
17011710 NETWORK_PROTOCOL_VERSION : "1.0" ,
0 commit comments