88from aws_xray_sdk .core .models import http
99from aws_xray_sdk .core .exceptions .exceptions import SegmentNotFoundException
1010from aws_xray_sdk .core .patcher import _PATCHED_MODULES
11- from aws_xray_sdk .ext .util import inject_trace_header , strip_url , unwrap
11+ from aws_xray_sdk .ext .util import inject_trace_header , strip_url , unwrap , get_hostname
1212
1313if sys .version_info >= (3 , 0 , 0 ):
1414 PY2 = False
@@ -33,7 +33,7 @@ def http_response_processor(wrapped, instance, args, kwargs, return_value,
3333 return
3434
3535 subsegment .put_http_meta (http .METHOD , xray_data .method )
36- subsegment .put_http_meta (http .URL , xray_data .url )
36+ subsegment .put_http_meta (http .URL , strip_url ( xray_data .url ) )
3737
3838 if return_value :
3939 subsegment .put_http_meta (http .STATUS , return_value .status )
@@ -57,7 +57,7 @@ def _xray_traced_http_getresponse(wrapped, instance, args, kwargs):
5757
5858 return xray_recorder .record_subsegment (
5959 wrapped , instance , args , kwargs ,
60- name = strip_url (xray_data .url ),
60+ name = get_hostname (xray_data .url ),
6161 namespace = 'remote' ,
6262 meta_processor = http_response_processor ,
6363 )
@@ -71,7 +71,7 @@ def http_send_request_processor(wrapped, instance, args, kwargs, return_value,
7171
7272 # we don't delete the attr as we can have multiple reads
7373 subsegment .put_http_meta (http .METHOD , xray_data .method )
74- subsegment .put_http_meta (http .URL , xray_data .url )
74+ subsegment .put_http_meta (http .URL , strip_url ( xray_data .url ) )
7575
7676 if exception :
7777 subsegment .add_exception (exception , stack )
@@ -111,7 +111,7 @@ def decompose_args(method, url, body, headers, encode_chunked=False):
111111 # we add a segment here in case connect fails
112112 return xray_recorder .record_subsegment (
113113 wrapped , instance , args , kwargs ,
114- name = strip_url (xray_data .url ),
114+ name = get_hostname (xray_data .url ),
115115 namespace = 'remote' ,
116116 meta_processor = http_send_request_processor
117117 )
@@ -127,7 +127,7 @@ def http_read_processor(wrapped, instance, args, kwargs, return_value,
127127
128128 # we don't delete the attr as we can have multiple reads
129129 subsegment .put_http_meta (http .METHOD , xray_data .method )
130- subsegment .put_http_meta (http .URL , xray_data .url )
130+ subsegment .put_http_meta (http .URL , strip_url ( xray_data .url ) )
131131 subsegment .put_http_meta (http .STATUS , instance .status )
132132
133133 if exception :
@@ -141,7 +141,7 @@ def _xray_traced_http_client_read(wrapped, instance, args, kwargs):
141141
142142 return xray_recorder .record_subsegment (
143143 wrapped , instance , args , kwargs ,
144- name = strip_url (xray_data .url ),
144+ name = get_hostname (xray_data .url ),
145145 namespace = 'remote' ,
146146 meta_processor = http_read_processor
147147 )
0 commit comments