Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e00110a
refactor: remove redundant pylint disable from celery instrumentation
forafox Oct 13, 2025
985b02f
cleanup: remove redundant pylint disable comments for attribute-defin…
forafox Oct 15, 2025
33578d7
cleanup: remove redundant pylint disable comments for attribute-defin…
forafox Oct 15, 2025
d09241a
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
forafox Oct 15, 2025
9718af3
Merge branch 'main' into cleanup/remove-pylint-disable-celery
forafox Dec 7, 2025
0f7004a
tests: format logging instrumentor fixtures
forafox Dec 9, 2025
7ba7c07
Merge branch 'main' into cleanup/remove-pylint-disable-celery
forafox Dec 9, 2025
d681d37
Merge branch 'main' into cleanup/remove-pylint-disable-celery
forafox Dec 13, 2025
5c14e7b
Merge branch 'main' into cleanup/remove-pylint-disable-celery
forafox Dec 23, 2025
e16dd53
Merge branch 'main' into cleanup/remove-pylint-disable-celery and add…
forafox Mar 17, 2026
dec395e
Merge branch 'main' into cleanup/remove-pylint-disable-celery
forafox Mar 17, 2026
f3073d6
Merge upstream main into cleanup/remove-pylint-disable-celery
forafox Mar 21, 2026
dfab3bc
Merge remote-tracking branch 'origin/cleanup/remove-pylint-disable-ce…
forafox Mar 21, 2026
e53ef3b
fix: resolve ruff linting errors after merge
forafox Mar 21, 2026
dbf91a4
fix: apply ruff format to botocore __init__.py
forafox Mar 21, 2026
663d041
Merge branch 'main' into cleanup/remove-pylint-disable-celery
aabmass May 7, 2026
2b9d102
Update CHANGELOG.md
xrmx May 7, 2026
351b52b
Merge branch 'main' into cleanup/remove-pylint-disable-celery
lzchen May 7, 2026
12dad59
Merge branch 'main' into cleanup/remove-pylint-disable-celery
lzchen May 7, 2026
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 @@ -80,7 +80,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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#4335](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4335))
- Expand `AGENTS.md` with instrumentation/GenAI guidance and add PR review instructions.
([#4457](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4457))
- Remove redundant `pylint: disable=attribute-defined-outside-init` comments and add rule to global `.pylintrc` disable list
([#3839](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3839))
- `opentelemetry-exporter-richconsole`: Add support for suppressing resource information
([#3898](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3898))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,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 @@ -120,7 +120,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 @@ -465,9 +465,10 @@ def _instrument(self, **kwargs):
)
)
return
# pylint: disable=attribute-defined-outside-init

# Convert slash-delimited paths to dot-delimited for valid Python imports
lambda_handler = lambda_handler.replace("/", ".")

(
self._wrapped_module_name,
self._wrapped_function_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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 Expand Up @@ -177,7 +176,7 @@ def _safe_end_processing_span(receipt_handle: str) -> None:
@staticmethod
def _extract_queue_name_from_url(queue_url: str) -> str:
# A Queue name cannot have the `/` char, therefore we can return the part after the last /
return queue_url.split("/")[-1]
return queue_url.rsplit("/", maxsplit=1)[-1]

def _create_processing_span(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def response_hook(span, service_name, operation_name, result):
suppress_http_instrumentation,
unwrap,
)
from opentelemetry.metrics import Instrument
from opentelemetry.propagators.aws.aws_xray_propagator import (
TRACE_HEADER_KEY,
AwsXRayPropagator,
Expand Down Expand Up @@ -181,7 +182,15 @@ def instrumentation_dependencies(self) -> Collection[str]:
return _instruments_botocore

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
self._loggers = {}
# meters are lazy initialized per-extension in _get_meter
self._meters = {}
# metrics are lazy initialized per-extension in _get_metrics
self._metrics: Dict[str, Dict[str, Instrument]] = {}

self.request_hook = kwargs.get("request_hook")
self.response_hook = kwargs.get("response_hook")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,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 @@ -124,7 +124,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 @@ -219,7 +219,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 @@ -538,7 +538,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 @@ -2052,7 +2052,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 @@ -726,7 +726,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 @@ -110,5 +110,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 @@ -40,7 +40,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 @@ -77,7 +76,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 @@ -309,7 +309,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 @@ -363,7 +363,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 @@ -495,7 +495,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 @@ -347,7 +347,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 @@ -1082,7 +1082,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 @@ -35,7 +35,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()
Expand Down Expand Up @@ -66,7 +66,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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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 @@ -64,7 +64,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 @@ -539,7 +538,6 @@ def make_client(self, *mock_socket_values, **kwargs):
# pylint: disable=import-outside-toplevel
from pymemcache.client.hash import HashClient # noqa: PLC0415

# 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 @@ -60,5 +60,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 @@ -166,7 +166,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 @@ -47,7 +47,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 setUp(self):
super().setUp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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 setUp(self):
super().setUp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,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
Loading