52
52
from opentelemetry .semconv .attributes .network_attributes import (
53
53
NETWORK_PROTOCOL_VERSION ,
54
54
)
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
+ )
56
59
from opentelemetry .semconv .attributes .url_attributes import (
57
60
URL_PATH ,
58
61
URL_QUERY ,
@@ -401,6 +404,7 @@ def validate_outputs(
401
404
"attributes" : {
402
405
HTTP_REQUEST_METHOD : "GET" ,
403
406
URL_SCHEME : "http" ,
407
+ SERVER_ADDRESS : "127.0.0.1" ,
404
408
SERVER_PORT : 80 ,
405
409
NETWORK_PROTOCOL_VERSION : "1.0" ,
406
410
URL_PATH : "/" ,
@@ -436,6 +440,7 @@ def validate_outputs(
436
440
"attributes" : {
437
441
HTTP_REQUEST_METHOD : "GET" ,
438
442
URL_SCHEME : "http" ,
443
+ SERVER_ADDRESS : "127.0.0.1" ,
439
444
SERVER_PORT : 80 ,
440
445
NETWORK_PROTOCOL_VERSION : "1.0" ,
441
446
URL_PATH : "/" ,
@@ -706,7 +711,7 @@ async def test_behavior_with_scope_server_as_none_new_semconv(self):
706
711
def update_expected_server (expected ):
707
712
expected [3 ]["attributes" ].update (
708
713
{
709
- CLIENT_ADDRESS : "0.0.0.0" ,
714
+ SERVER_ADDRESS : "0.0.0.0" ,
710
715
SERVER_PORT : 80 ,
711
716
}
712
717
)
@@ -733,7 +738,7 @@ def update_expected_server(expected):
733
738
SpanAttributes .HTTP_HOST : "0.0.0.0" ,
734
739
SpanAttributes .NET_HOST_PORT : 80 ,
735
740
SpanAttributes .HTTP_URL : "http://0.0.0.0/" ,
736
- CLIENT_ADDRESS : "0.0.0.0" ,
741
+ SERVER_ADDRESS : "0.0.0.0" ,
737
742
SERVER_PORT : 80 ,
738
743
}
739
744
)
@@ -948,7 +953,7 @@ async def test_websocket(self):
948
953
SpanAttributes .HTTP_HOST : self .scope ["server" ][0 ],
949
954
SpanAttributes .HTTP_FLAVOR : self .scope ["http_version" ],
950
955
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' ] } " ,
952
957
SpanAttributes .NET_PEER_IP : self .scope ["client" ][0 ],
953
958
SpanAttributes .NET_PEER_PORT : self .scope ["client" ][1 ],
954
959
SpanAttributes .HTTP_STATUS_CODE : 200 ,
@@ -1018,6 +1023,7 @@ async def test_websocket_new_semconv(self):
1018
1023
"kind" : trace_api .SpanKind .SERVER ,
1019
1024
"attributes" : {
1020
1025
URL_SCHEME : self .scope ["scheme" ],
1026
+ SERVER_ADDRESS : self .scope ["server" ][0 ],
1021
1027
SERVER_PORT : self .scope ["server" ][1 ],
1022
1028
NETWORK_PROTOCOL_VERSION : self .scope ["http_version" ],
1023
1029
URL_PATH : self .scope ["path" ],
@@ -1096,12 +1102,13 @@ async def test_websocket_both_semconv(self):
1096
1102
SpanAttributes .HTTP_HOST : self .scope ["server" ][0 ],
1097
1103
SpanAttributes .HTTP_FLAVOR : self .scope ["http_version" ],
1098
1104
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' ] } " ,
1100
1106
SpanAttributes .NET_PEER_IP : self .scope ["client" ][0 ],
1101
1107
SpanAttributes .NET_PEER_PORT : self .scope ["client" ][1 ],
1102
1108
SpanAttributes .HTTP_STATUS_CODE : 200 ,
1103
1109
SpanAttributes .HTTP_METHOD : self .scope ["method" ],
1104
1110
URL_SCHEME : self .scope ["scheme" ],
1111
+ SERVER_ADDRESS : self .scope ["server" ][0 ],
1105
1112
SERVER_PORT : self .scope ["server" ][1 ],
1106
1113
NETWORK_PROTOCOL_VERSION : self .scope ["http_version" ],
1107
1114
URL_PATH : self .scope ["path" ],
@@ -1661,6 +1668,7 @@ def test_request_attributes_new_semconv(self):
1661
1668
HTTP_REQUEST_METHOD : "GET" ,
1662
1669
URL_PATH : "/" ,
1663
1670
URL_QUERY : "foo=bar" ,
1671
+ SERVER_ADDRESS : "127.0.0.1" ,
1664
1672
SERVER_PORT : 80 ,
1665
1673
URL_SCHEME : "http" ,
1666
1674
NETWORK_PROTOCOL_VERSION : "1.0" ,
@@ -1696,6 +1704,7 @@ def test_request_attributes_both_semconv(self):
1696
1704
HTTP_REQUEST_METHOD : "GET" ,
1697
1705
URL_PATH : "/" ,
1698
1706
URL_QUERY : "foo=bar" ,
1707
+ SERVER_ADDRESS : "127.0.0.1" ,
1699
1708
SERVER_PORT : 80 ,
1700
1709
URL_SCHEME : "http" ,
1701
1710
NETWORK_PROTOCOL_VERSION : "1.0" ,
0 commit comments