Skip to content

Commit c9626a9

Browse files
adriangbocelotl
authored andcommitted
lint
1 parent f09e3a9 commit c9626a9

File tree

8 files changed

+48
-18
lines changed

8 files changed

+48
-18
lines changed

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
210210
raise
211211
else:
212212
_apply_response_attributes(span, result)
213-
_safe_invoke(extension.on_success, span, result)
213+
_safe_invoke(extension.on_success, span, result)
214214
finally:
215215
_safe_invoke(extension.after_service_call)
216216
self._call_response_hook(span, call_context, result)

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828

2929
from opentelemetry import trace as trace_api
3030
from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
31-
from opentelemetry.instrumentation.utils import suppress_http_instrumentation, suppress_instrumentation
31+
from opentelemetry.instrumentation.utils import (
32+
suppress_http_instrumentation,
33+
suppress_instrumentation,
34+
)
3235
from opentelemetry.propagate import get_global_textmap, set_global_textmap
3336
from opentelemetry.propagators.aws.aws_xray_propagator import TRACE_HEADER_KEY
3437
from opentelemetry.semconv.trace import SpanAttributes

instrumentation/opentelemetry-instrumentation-cassandra/src/opentelemetry/instrumentation/cassandra/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ def _traced_execute_async(func, instance, args, kwargs):
7070
if span.is_recording():
7171
span.set_attribute(SpanAttributes.DB_NAME, instance.keyspace)
7272
span.set_attribute(SpanAttributes.DB_SYSTEM, "cassandra")
73-
span.set_attribute(SpanAttributes.NET_PEER_NAME, instance.cluster.contact_points)
73+
span.set_attribute(
74+
SpanAttributes.NET_PEER_NAME,
75+
instance.cluster.contact_points,
76+
)
7477

7578
if include_db_statement:
7679
query = args[0]
@@ -79,7 +82,9 @@ def _traced_execute_async(func, instance, args, kwargs):
7982
response = func(*args, **kwargs)
8083
return response
8184

82-
wrap_function_wrapper("cassandra.cluster", "Session.execute_async", _traced_execute_async)
85+
wrap_function_wrapper(
86+
"cassandra.cluster", "Session.execute_async", _traced_execute_async
87+
)
8388

8489

8590
class CassandraInstrumentor(BaseInstrumentor):

instrumentation/opentelemetry-instrumentation-cassandra/tests/test_cassandra_integration.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,25 @@ def tearDown(self):
4646
def test_instrument_uninstrument(self):
4747
instrumentation = CassandraInstrumentor()
4848
instrumentation.instrument()
49-
self.assertTrue(isinstance(cassandra.cluster.Session.execute_async, BoundFunctionWrapper))
49+
self.assertTrue(
50+
isinstance(
51+
cassandra.cluster.Session.execute_async, BoundFunctionWrapper
52+
)
53+
)
5054

5155
instrumentation.uninstrument()
52-
self.assertFalse(isinstance(cassandra.cluster.Session.execute_async, BoundFunctionWrapper))
56+
self.assertFalse(
57+
isinstance(
58+
cassandra.cluster.Session.execute_async, BoundFunctionWrapper
59+
)
60+
)
5361

5462
@mock.patch("cassandra.cluster.Cluster.connect")
5563
@mock.patch("cassandra.cluster.Session.__init__")
5664
@mock.patch("cassandra.cluster.Session._create_response_future")
57-
def test_instrumentor(self, mock_create_response_future, mock_session_init, mock_connect):
65+
def test_instrumentor(
66+
self, mock_create_response_future, mock_session_init, mock_connect
67+
):
5868
mock_create_response_future.return_value = mock.Mock()
5969
mock_session_init.return_value = None
6070
mock_connect.return_value = cassandra.cluster.Session()
@@ -85,7 +95,9 @@ def test_instrumentor(self, mock_create_response_future, mock_session_init, mock
8595
@mock.patch("cassandra.cluster.Cluster.connect")
8696
@mock.patch("cassandra.cluster.Session.__init__")
8797
@mock.patch("cassandra.cluster.Session._create_response_future")
88-
def test_custom_tracer_provider(self, mock_create_response_future, mock_session_init, mock_connect):
98+
def test_custom_tracer_provider(
99+
self, mock_create_response_future, mock_session_init, mock_connect
100+
):
89101
mock_create_response_future.return_value = mock.Mock()
90102
mock_session_init.return_value = None
91103
mock_connect.return_value = cassandra.cluster.Session()
@@ -107,7 +119,9 @@ def test_custom_tracer_provider(self, mock_create_response_future, mock_session_
107119
@mock.patch("cassandra.cluster.Cluster.connect")
108120
@mock.patch("cassandra.cluster.Session.__init__")
109121
@mock.patch("cassandra.cluster.Session._create_response_future")
110-
def test_instrument_connection_no_op_tracer_provider(self, mock_create_response_future, mock_session_init, mock_connect):
122+
def test_instrument_connection_no_op_tracer_provider(
123+
self, mock_create_response_future, mock_session_init, mock_connect
124+
):
111125
mock_create_response_future.return_value = mock.Mock()
112126
mock_session_init.return_value = None
113127
mock_connect.return_value = cassandra.cluster.Session()

instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ def test_flask_metric_values(self):
327327
if isinstance(point, NumberDataPoint):
328328
self.assertEqual(point.value, 0)
329329

330-
def _assert_basic_metric(self, expected_duration_attributes, expected_requests_count_attributes):
330+
def _assert_basic_metric(
331+
self, expected_duration_attributes, expected_requests_count_attributes
332+
):
331333
metrics_list = self.memory_metrics_reader.get_metrics_data()
332334
for resource_metric in metrics_list.resource_metrics:
333335
for scope_metrics in resource_metric.scope_metrics:
@@ -393,7 +395,7 @@ def test_basic_metric_nonstandard_http_method_success(self):
393395
)
394396

395397
@patch.dict(
396-
"os.environ",
398+
"os.environ",
397399
{
398400
OTEL_PYTHON_INSTRUMENTATION_HTTP_CAPTURE_ALL_METHODS: "1",
399401
},

instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def response_hook(span, request_obj, response)
8989
from opentelemetry.instrumentation.urllib.package import _instruments
9090
from opentelemetry.instrumentation.urllib.version import __version__
9191
from opentelemetry.instrumentation.utils import (
92+
http_status_to_status_code,
9293
is_http_instrumentation_enabled,
9394
suppress_http_instrumentation,
94-
http_status_to_status_code,
9595
)
9696
from opentelemetry.metrics import Histogram, get_meter
9797
from opentelemetry.propagate import inject

instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ def collect_request_attributes(environ):
302302
"""
303303

304304
result = {
305-
SpanAttributes.HTTP_METHOD: sanitize_method(environ.get("REQUEST_METHOD")),
305+
SpanAttributes.HTTP_METHOD: sanitize_method(
306+
environ.get("REQUEST_METHOD")
307+
),
306308
SpanAttributes.HTTP_SERVER_NAME: environ.get("SERVER_NAME"),
307309
SpanAttributes.HTTP_SCHEME: environ.get("wsgi.url_scheme"),
308310
}

instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,22 +287,26 @@ def test_wsgi_metrics(self):
287287
self.assertTrue(number_data_point_seen and histogram_data_point_seen)
288288

289289
def test_nonstandard_http_method(self):
290-
self.environ["REQUEST_METHOD"]= "NONSTANDARD"
290+
self.environ["REQUEST_METHOD"] = "NONSTANDARD"
291291
app = otel_wsgi.OpenTelemetryMiddleware(simple_wsgi)
292292
response = app(self.environ, self.start_response)
293-
self.validate_response(response, span_name="UNKNOWN /", http_method="UNKNOWN")
293+
self.validate_response(
294+
response, span_name="UNKNOWN /", http_method="UNKNOWN"
295+
)
294296

295297
@mock.patch.dict(
296-
"os.environ",
298+
"os.environ",
297299
{
298300
OTEL_PYTHON_INSTRUMENTATION_HTTP_CAPTURE_ALL_METHODS: "1",
299301
},
300302
)
301303
def test_nonstandard_http_method_allowed(self):
302-
self.environ["REQUEST_METHOD"]= "NONSTANDARD"
304+
self.environ["REQUEST_METHOD"] = "NONSTANDARD"
303305
app = otel_wsgi.OpenTelemetryMiddleware(simple_wsgi)
304306
response = app(self.environ, self.start_response)
305-
self.validate_response(response, span_name="NONSTANDARD /", http_method="NONSTANDARD")
307+
self.validate_response(
308+
response, span_name="NONSTANDARD /", http_method="NONSTANDARD"
309+
)
306310

307311
def test_default_span_name_missing_path_info(self):
308312
"""Test that default span_names with missing path info."""

0 commit comments

Comments
 (0)