@@ -27,15 +27,19 @@ def setup_once():
27
27
28
28
29
29
def _get_span_description (host , port ):
30
- # type: (Union[bytes, str, None], Union[str, int, None]) -> str
30
+ # type: (Union[bytes, str, None], Union[bytes, str, int, None]) -> str
31
31
32
32
try :
33
33
host = host .decode () # type: ignore
34
34
except (UnicodeDecodeError , AttributeError ):
35
35
pass
36
36
37
- description = "%s:%s" % (host , port ) # type: ignore
37
+ try :
38
+ port = port .decode () # type: ignore
39
+ except (UnicodeDecodeError , AttributeError ):
40
+ pass
38
41
42
+ description = "%s:%s" % (host , port ) # type: ignore
39
43
return description
40
44
41
45
@@ -74,7 +78,7 @@ def _patch_getaddrinfo():
74
78
real_getaddrinfo = socket .getaddrinfo
75
79
76
80
def getaddrinfo (host , port , family = 0 , type = 0 , proto = 0 , flags = 0 ):
77
- # type: (Union[bytes, str, None], Union[str, int, None], int, int, int, int) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]
81
+ # type: (Union[bytes, str, None], Union[bytes, str, int, None], int, int, int, int) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int], Tuple[int, bytes ]]]]
78
82
integration = sentry_sdk .get_client ().get_integration (SocketIntegration )
79
83
if integration is None :
80
84
return real_getaddrinfo (host , port , family , type , proto , flags )
@@ -89,4 +93,4 @@ def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
89
93
90
94
return real_getaddrinfo (host , port , family , type , proto , flags )
91
95
92
- socket .getaddrinfo = getaddrinfo # type: ignore
96
+ socket .getaddrinfo = getaddrinfo
0 commit comments