|
14 | 14 |
|
15 | 15 | from newrelic.api.external_trace import ExternalTraceWrapper |
16 | 16 | from newrelic.common.object_wrapper import wrap_function_wrapper |
17 | | -from newrelic.hooks.external_httplib2 import ( |
18 | | - _nr_wrapper_httplib2_endheaders_wrapper) |
| 17 | +from newrelic.hooks.external_httplib2 import _nr_wrapper_httplib2_endheaders_wrapper |
19 | 18 |
|
20 | 19 |
|
21 | 20 | def _nr_wrapper_make_request_(wrapped, instance, args, kwargs): |
22 | | - |
23 | 21 | def _bind_params(conn, method, url, *args, **kwargs): |
24 | | - return "%s://%s:%s" % (instance.scheme, conn.host, conn.port) |
| 22 | + return method, "%s://%s:%s" % (instance.scheme, conn.host, conn.port) |
25 | 23 |
|
26 | | - url_for_apm_ui = _bind_params(*args, **kwargs) |
| 24 | + method, url_for_apm_ui = _bind_params(*args, **kwargs) |
27 | 25 |
|
28 | | - return ExternalTraceWrapper(wrapped, 'urllib3', url_for_apm_ui)(*args, **kwargs) |
| 26 | + return ExternalTraceWrapper(wrapped, "urllib3", url_for_apm_ui, method=method)(*args, **kwargs) |
29 | 27 |
|
30 | 28 |
|
31 | 29 | def instrument_urllib3_connectionpool(module): |
32 | | - wrap_function_wrapper(module, 'HTTPSConnectionPool._make_request', |
33 | | - _nr_wrapper_make_request_) |
34 | | - wrap_function_wrapper(module, 'HTTPConnectionPool._make_request', |
35 | | - _nr_wrapper_make_request_) |
| 30 | + wrap_function_wrapper(module, "HTTPSConnectionPool._make_request", _nr_wrapper_make_request_) |
| 31 | + wrap_function_wrapper(module, "HTTPConnectionPool._make_request", _nr_wrapper_make_request_) |
36 | 32 |
|
37 | 33 |
|
38 | 34 | def instrument_urllib3_connection(module): |
39 | 35 | # Don't combine the instrument functions into a single function. Keep |
40 | 36 | # the 'connect' monkey patch separate, because it is also used to patch |
41 | 37 | # urllib3 within the requests package. |
42 | 38 |
|
43 | | - wrap_function_wrapper(module, 'HTTPSConnection.endheaders', |
44 | | - _nr_wrapper_httplib2_endheaders_wrapper('urllib3', 'https')) |
| 39 | + wrap_function_wrapper( |
| 40 | + module, "HTTPSConnection.endheaders", _nr_wrapper_httplib2_endheaders_wrapper("urllib3", "https") |
| 41 | + ) |
45 | 42 |
|
46 | | - wrap_function_wrapper(module, 'HTTPConnection.endheaders', |
47 | | - _nr_wrapper_httplib2_endheaders_wrapper('urllib3', 'http')) |
| 43 | + wrap_function_wrapper( |
| 44 | + module, "HTTPConnection.endheaders", _nr_wrapper_httplib2_endheaders_wrapper("urllib3", "http") |
| 45 | + ) |
0 commit comments