Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shalevr committed Jul 26, 2022
1 parent 1484ef0 commit f4261ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,23 @@ def instrumented_urlopen(wrapped, instance, args, kwargs):
SpanAttributes.HTTP_SCHEME: instance.scheme,
SpanAttributes.HTTP_STATUS_CODE: response.status,
SpanAttributes.NET_PEER_NAME: instance.host,
SpanAttributes.NET_PEER_PORT: instance.port
SpanAttributes.NET_PEER_PORT: instance.port,
}

version = getattr(response, "version")
if version:
metric_labels[SpanAttributes.HTTP_FLAVOR] = \
metric_labels[SpanAttributes.HTTP_FLAVOR] = (
"1.1" if version == 11 else "1.0"
)

request_size = 0 if body is None else len(body)
duration_histogram.record(elapsed_time, attributes=metric_labels)
request_size_histogram.record(request_size, attributes=metric_labels)
response_size_histogram.record(len(response.data), attributes=metric_labels)
request_size_histogram.record(
request_size, attributes=metric_labels
)
response_size_histogram.record(
len(response.data), attributes=metric_labels
)

return response

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def assert_span(self, num_spans=1):
return span_list[0]
return span_list

def assert_success_span(self, response: urllib3.response.HTTPResponse, url: str):
def assert_success_span(
self, response: urllib3.response.HTTPResponse, url: str
):
self.assertEqual(b"Hello!", response.data)

span = self.assert_span()
Expand Down Expand Up @@ -145,7 +147,8 @@ def test_basic_metric_check_client_size_get(self):
)
self.assertIn(metric.name, expected_metrics)
self.assertDictEqual(
expected_attributes, dict(data_point.attributes)
expected_attributes,
dict(data_point.attributes),
)
self.assertEqual(data_point.count, 1)

Expand Down Expand Up @@ -199,6 +202,7 @@ def test_basic_metric_check_client_size_post(self):
self.assertIn(metric.name, expected_metrics)

self.assertDictEqual(
expected_attributes, dict(data_point.attributes)
expected_attributes,
dict(data_point.attributes),
)
self.assertEqual(data_point.count, 1)

0 comments on commit f4261ba

Please sign in to comment.