Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 76f1f23

Browse files
committedSep 2, 2021
adding up to date generated code
1 parent 42995da commit 76f1f23

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed
 

Diff for: ‎instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,13 @@ def instrumented_urlopen(wrapped, instance, args, kwargs):
191191
)
192192

193193

194-
def _call_request_hook(request_hook: typing.Union[_RequestHookT, _ExtendedRequestHookT],
195-
span: Span,
196-
connection_pool: urllib3.connectionpool.HTTPConnectionPool,
197-
headers: typing.Dict,
198-
body: str):
194+
def _call_request_hook(
195+
request_hook: typing.Union[_RequestHookT, _ExtendedRequestHookT],
196+
span: Span,
197+
connection_pool: urllib3.connectionpool.HTTPConnectionPool,
198+
headers: typing.Dict,
199+
body: str,
200+
):
199201
try:
200202
# First assume request_hook is a function of type _ExtendedRequestHookT
201203
request_hook(span, connection_pool, headers, body)

Diff for: ‎instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def setUp(self):
4747
httpretty.register_uri(httpretty.GET, self.HTTPS_URL, body="Hello!")
4848
httpretty.register_uri(httpretty.POST, self.HTTP_URL, body="Hello!")
4949

50-
5150
def tearDown(self):
5251
super().tearDown()
5352
URLLib3Instrumentor().uninstrument()
@@ -288,21 +287,23 @@ def extended_request_hook(span, request, headers, body):
288287
span.set_attribute("request_hook_body", body)
289288

290289
URLLib3Instrumentor().uninstrument()
291-
URLLib3Instrumentor().instrument(
292-
request_hook=extended_request_hook,
293-
)
290+
URLLib3Instrumentor().instrument(request_hook=extended_request_hook,)
294291

295292
headers = {"header1": "value1", "header2": "value2"}
296293
body = "param1=1&param2=2"
297294

298295
pool = urllib3.HTTPConnectionPool("httpbin.org")
299-
response = pool.request("POST", "/status/200", body=body, headers=headers)
296+
response = pool.request(
297+
"POST", "/status/200", body=body, headers=headers
298+
)
300299

301300
self.assertEqual(b"Hello!", response.data)
302301

303302
span = self.assert_span()
304303

305304
self.assertIn("request_hook_headers", span.attributes)
306-
self.assertEqual(span.attributes["request_hook_headers"], json.dumps(headers))
305+
self.assertEqual(
306+
span.attributes["request_hook_headers"], json.dumps(headers)
307+
)
307308
self.assertIn("request_hook_body", span.attributes)
308309
self.assertEqual(span.attributes["request_hook_body"], body)

0 commit comments

Comments
 (0)
Please sign in to comment.