Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ disable=missing-docstring,
missing-module-docstring, # temp-pylint-upgrade
import-error, # needed as a workaround as reported here: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/290
cyclic-import,
not-context-manager
not-context-manager,
attribute-defined-outside-init

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def __init__(self, *args, **kwargs):


class AioHttpServerInstrumentor(BaseInstrumentor):
# pylint: disable=protected-access,attribute-defined-outside-init
# pylint: disable=protected-access
"""An instrumentor for aiohttp.web.Application

See `BaseInstrumentor`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def instrumentation_dependencies(self) -> Collection[str]:
return _instruments

def _instrument(self, **kwargs):
# pylint: disable=attribute-defined-outside-init
self._tracer = get_tracer(
__name__, __version__, kwargs.get("tracer_provider")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ def _instrument(self, **kwargs):
)
)
return
# pylint: disable=attribute-defined-outside-init
(
self._wrapped_module_name,
self._wrapped_function_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def _instrument(self, **kwargs):
# For example EC2 uses AWSQueryConnection and S3 uses
# AWSAuthConnection

# pylint: disable=attribute-defined-outside-init
self._tracer = get_tracer(
__name__,
__version__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def set(self, carrier: CarrierT, key: str, value: str) -> None:
boto3sqs_setter = Boto3SQSSetter()


# pylint: disable=attribute-defined-outside-init
class Boto3SQSInstrumentor(BaseInstrumentor):
received_messages_spans: Dict[str, Span] = {}
current_span_related_to_token: Span = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ def instrumentation_dependencies(self) -> Collection[str]:
return _instruments

def _instrument(self, **kwargs):
# pylint: disable=attribute-defined-outside-init

# tracers are lazy initialized per-extension in _get_tracer
self._tracers = {}
# loggers are lazy initialized per-extension in _get_logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ def before_service_call(
span.update_name(f"{operation_name} {request_model}")

# this is used to calculate the operation duration metric, duration may be skewed by request_hook
# pylint: disable=attribute-defined-outside-init
self._operation_start = default_timer()

# pylint: disable=no-self-use,too-many-locals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def instrumentation_dependencies(self) -> Collection[str]:
def _instrument(self, **kwargs):
tracer_provider = kwargs.get("tracer_provider")

# pylint: disable=attribute-defined-outside-init
self._tracer = trace.get_tracer(
__name__,
__version__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ class ConfluentKafkaInstrumentor(BaseInstrumentor):
See `BaseInstrumentor`
"""

# pylint: disable=attribute-defined-outside-init
@staticmethod
def instrument_producer(
producer: Producer, tracer_provider=None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def process_response(self, req, resp, resource, req_succeeded=None): # pylint:d


class FalconInstrumentor(BaseInstrumentor):
# pylint: disable=protected-access,attribute-defined-outside-init
# pylint: disable=protected-access
"""An instrumentor for falcon.API

See `BaseInstrumentor`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,6 @@ async def _(*_):
)


# pylint: disable=attribute-defined-outside-init
class TestFastAPIFallback(TestBaseFastAPI):
@pytest.fixture(autouse=True)
def inject_fixtures(self, caplog):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def __init__(self, *args, **kwargs):


class FlaskInstrumentor(BaseInstrumentor):
# pylint: disable=protected-access,attribute-defined-outside-init
# pylint: disable=protected-access
"""An instrumentor for flask.Flask

See `BaseInstrumentor`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,4 @@ def excluded2_endpoint():
self._repeat_custom_response_headers
)

# pylint: disable=attribute-defined-outside-init
self.client = Client(self.app, Response)
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def test_uninstrument(self):
self.app = flask.Flask(__name__)

self.app.route("/hello/<int:helloid>")(self._hello_endpoint)
# pylint: disable=attribute-defined-outside-init
self.client = Client(self.app, Response)

resp = self.client.get("/hello/123")
Expand Down Expand Up @@ -88,7 +87,6 @@ def test_no_op_tracer_provider(self):

self.app = flask.Flask(__name__)
self.app.route("/hello/<int:helloid>")(self._hello_endpoint)
# pylint: disable=attribute-defined-outside-init
self.client = Client(self.app, Response)
self.client.get("/hello/123")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class GrpcInstrumentorServer(BaseInstrumentor):

"""

# pylint:disable=attribute-defined-outside-init, redefined-outer-name
# pylint:disable=redefined-outer-name

def __init__(self, filter_=None):
excluded_service_filter = _excluded_service_filter()
Expand Down Expand Up @@ -374,7 +374,7 @@ class GrpcAioInstrumentorServer(BaseInstrumentor):

"""

# pylint:disable=attribute-defined-outside-init, redefined-outer-name
# pylint:disable=redefined-outer-name

def __init__(self, filter_=None):
excluded_service_filter = _excluded_service_filter()
Expand Down Expand Up @@ -506,7 +506,7 @@ class GrpcAioInstrumentorClient(BaseInstrumentor):

"""

# pylint:disable=attribute-defined-outside-init, redefined-outer-name
# pylint:disable=redefined-outer-name

def __init__(self, filter_=None):
excluded_service_filter = _excluded_service_filter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ async def test_span_lifetime(self):
class SpanLifetimeServicer(GRPCTestServerServicer):
# pylint:disable=C0103
async def SimpleMethod(self, request, context):
# pylint:disable=attribute-defined-outside-init
self.span = trace.get_current_span()

return Response(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ async def aclose(self) -> None:


class HTTPXClientInstrumentor(BaseInstrumentor):
# pylint: disable=protected-access,attribute-defined-outside-init
# pylint: disable=protected-access
"""An instrumentor for httpx Client and AsyncClient

See `BaseInstrumentor`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def get_tracer( # pylint: disable=no-self-use
class TestLoggingInstrumentorProxyTracerProvider(TestBase):
@pytest.fixture(autouse=True)
def inject_fixtures(self, caplog):
self.caplog = caplog # pylint: disable=attribute-defined-outside-init

self.caplog = caplog
def setUp(self):
super().setUp()
LoggingInstrumentor().instrument(tracer_provider=FakeTracerProvider())
Expand Down Expand Up @@ -72,8 +71,7 @@ def log_hook(span, record):
class TestLoggingInstrumentor(TestBase):
@pytest.fixture(autouse=True)
def inject_fixtures(self, caplog):
self.caplog = caplog # pylint: disable=attribute-defined-outside-init

self.caplog = caplog
def setUp(self):
super().setUp()
LoggingInstrumentor().instrument()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def _consumer_callback_attribute_name() -> str:
class PikaInstrumentor(BaseInstrumentor): # type: ignore
CONSUMER_CALLBACK_ATTR = _consumer_callback_attribute_name()

# pylint: disable=attribute-defined-outside-init
@staticmethod
def _instrument_channel_consumers(
channel: Union[BlockingChannel, Channel],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def tearDown(self):
PymemcacheInstrumentor().uninstrument()

def make_client(self, mock_socket_values, **kwargs):
# pylint: disable=attribute-defined-outside-init
self.client = pymemcache.client.base.Client(
(TEST_HOST, TEST_PORT), **kwargs
)
Expand Down Expand Up @@ -554,7 +553,6 @@ def make_client(self, *mock_socket_values, **kwargs):
# pylint: disable=import-outside-toplevel
from pymemcache.client.hash import HashClient

# pylint: disable=attribute-defined-outside-init
self.client = HashClient([], **kwargs)
ip = TEST_HOST

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,4 @@ def excluded2_endpoint(request):
route_name="custom_response_headers",
)

# pylint: disable=attribute-defined-outside-init
self.client = Client(config.make_wsgi_app(), TestResponse)
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ def instrumentation_dependencies(self) -> Collection[str]:
def _instrument(self, **kwargs):
tracer_provider = kwargs.get("tracer_provider")

# pylint: disable=attribute-defined-outside-init
self._tracer = trace.get_tracer(
__name__,
__version__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
class TestSqlalchemyInstrumentation(TestBase):
@pytest.fixture(autouse=True)
def inject_fixtures(self, caplog):
self.caplog = caplog # pylint: disable=attribute-defined-outside-init
self.caplog = caplog

def tearDown(self):
super().tearDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class TestSqlalchemyInstrumentationWithSQLCommenter(TestBase):
@pytest.fixture(autouse=True)
def inject_fixtures(self, caplog):
self.caplog = caplog # pylint: disable=attribute-defined-outside-init
self.caplog = caplog

def tearDown(self):
super().tearDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def _instrument(self, **kwargs):
None
"""
tracer_provider = kwargs.get("tracer_provider")
# pylint: disable=attribute-defined-outside-init
self._tracer = trace.get_tracer(
__name__,
__version__,
Expand Down