Skip to content

Commit

Permalink
linty linty
Browse files Browse the repository at this point in the history
  • Loading branch information
rjduffner committed Mar 16, 2022
1 parent d2a99d2 commit 56f55d2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
| [opentelemetry-instrumentation-dbapi](./opentelemetry-instrumentation-dbapi) | dbapi |
| [opentelemetry-instrumentation-django](./opentelemetry-instrumentation-django) | django >= 1.10 |
| [opentelemetry-instrumentation-elasticsearch](./opentelemetry-instrumentation-elasticsearch) | elasticsearch >= 2.0 |
| [opentelemetry-instrumentation-falcon](./opentelemetry-instrumentation-falcon) | falcon >= 2.0.0, < 4.0.0 |
| [opentelemetry-instrumentation-falcon](./opentelemetry-instrumentation-falcon) | falcon >= 1.4.1, < 4.0.0 |
| [opentelemetry-instrumentation-fastapi](./opentelemetry-instrumentation-fastapi) | fastapi ~= 0.58 |
| [opentelemetry-instrumentation-flask](./opentelemetry-instrumentation-flask) | flask >= 1.0, < 3.0 |
| [opentelemetry-instrumentation-grpc](./opentelemetry-instrumentation-grpc) | grpcio ~= 1.27 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ def response_hook(span, req, resp):
"""

from logging import getLogger
from packaging import version as package_version
from sys import exc_info
from typing import Collection

import falcon
from packaging import version as package_version

import opentelemetry.instrumentation.wsgi as otel_wsgi
from opentelemetry import context, trace
Expand Down Expand Up @@ -128,11 +128,11 @@ def response_hook(span, req, resp):
_response_propagation_setter = FuncSetter(falcon.Response.append_header)

_parsed_falcon_version = package_version.parse(falcon.__version__)
if _parsed_falcon_version >= package_version.parse('3.0.0'):
if _parsed_falcon_version >= package_version.parse("3.0.0"):
# Falcon 3
_instrument_app = "App"
_falcon_version = 3
elif _parsed_falcon_version >= package_version.parse('2.0.0'):
elif _parsed_falcon_version >= package_version.parse("2.0.0"):
# Falcon 2
_instrument_app = "API"
_falcon_version = 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from packaging import version as package_version
import falcon
from packaging import version as package_version

# pylint:disable=R0201,W0613,E0602

Expand Down Expand Up @@ -36,10 +36,10 @@ def on_get(self, req, resp):

def make_app():
_parsed_falcon_version = package_version.parse(falcon.__version__)
if _parsed_falcon_version >= package_version.parse('3.0.0'):
if _parsed_falcon_version >= package_version.parse("3.0.0"):
# Falcon 3
app = falcon.App()
elif _parsed_falcon_version >= package_version.parse('2.0.0'):
elif _parsed_falcon_version >= package_version.parse("2.0.0"):
# Falcon 2
app = falcon.API()
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ def test_head(self):
self._test_method("HEAD")

def _test_method(self, method):
self.client().simulate_request(
method=method, path="/hello"
)
self.client().simulate_request(method=method, path="/hello")
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 1)
span = spans[0]
Expand All @@ -108,7 +106,9 @@ def _test_method(self, method):
},
)
if SpanAttributes.NET_PEER_IP in span.attributes:
self.assertEqual(span.attributes[SpanAttributes.NET_PEER_IP], "127.0.0.1")
self.assertEqual(
span.attributes[SpanAttributes.NET_PEER_IP], "127.0.0.1"
)
self.memory_exporter.clear()

def test_404(self):
Expand All @@ -133,7 +133,9 @@ def test_404(self):
},
)
if SpanAttributes.NET_PEER_IP in span.attributes:
self.assertEqual(span.attributes[SpanAttributes.NET_PEER_IP], "127.0.0.1")
self.assertEqual(
span.attributes[SpanAttributes.NET_PEER_IP], "127.0.0.1"
)

def test_500(self):
try:
Expand Down Expand Up @@ -165,8 +167,9 @@ def test_500(self):
},
)
if SpanAttributes.NET_PEER_IP in span.attributes:
self.assertEqual(span.attributes[SpanAttributes.NET_PEER_IP], "127.0.0.1")

self.assertEqual(
span.attributes[SpanAttributes.NET_PEER_IP], "127.0.0.1"
)

def test_uninstrument(self):
self.client().simulate_get(path="/hello")
Expand Down Expand Up @@ -201,7 +204,9 @@ def test_trace_response(self):
orig = get_global_response_propagator()
set_global_response_propagator(TraceResponsePropagator())

response = self.client().simulate_get(path="/hello", query_string="q=abc")
response = self.client().simulate_get(
path="/hello", query_string="q=abc"
)
self.assertTraceResponseHeaderMatchesSpan(
response.headers, self.memory_exporter.get_finished_spans()[0]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.29b0",
},
"falcon": {
"library": "falcon >= 2.0.0, < 4.0.0",
"library": "falcon >= 1.4.1, < 4.0.0",
"instrumentation": "opentelemetry-instrumentation-falcon==0.29b0",
},
"fastapi": {
Expand Down

0 comments on commit 56f55d2

Please sign in to comment.