Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit ac4f52c

Browse files
tpyoreyang
authored andcommitted
Use httplib's host property instead of urllib3's _dns_host (#659)
1 parent 2ab5b1c commit ac4f52c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

contrib/opencensus-ext-httplib/opencensus/ext/httplib/trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def call(self, method, url, body, headers, *args, **kwargs):
6464
_tracer = execution_context.get_opencensus_tracer()
6565
blacklist_hostnames = execution_context.get_opencensus_attr(
6666
'blacklist_hostnames')
67-
dest_url = '{}:{}'.format(self._dns_host, self.port)
67+
dest_url = '{}:{}'.format(self.host, self.port)
6868
if utils.disable_tracing_hostname(dest_url, blacklist_hostnames):
6969
return request_func(self, method, url, body,
7070
headers, *args, **kwargs)

contrib/opencensus-ext-httplib/tests/test_httplib_trace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def test_wrap_httplib_request_blacklist_nok(self):
150150
wrapped = trace.wrap_httplib_request(mock_request_func)
151151

152152
mock_self = mock.Mock()
153-
mock_self._dns_host = 'localhost'
153+
mock_self.host = 'localhost'
154154
mock_self.port = '8080'
155155
method = 'GET'
156-
url = 'http://{}:{}'.format(mock_self._dns_host, mock_self.port)
156+
url = 'http://{}:{}'.format(mock_self.host, mock_self.port)
157157
body = None
158158
headers = {}
159159

0 commit comments

Comments
 (0)