From 0e9f8ac641c9761f9dc7a239b96e16d928063896 Mon Sep 17 00:00:00 2001 From: Luke Zhang Date: Mon, 13 Oct 2025 20:16:30 -0700 Subject: [PATCH] fix: suppress ruff PLC0415 for conditional gevent import The generate_instrumentation_bootstrap.py script was failing with a ruff linting error (PLC0415: import should be at top-level) when checking the auto_instrumentation module. Add noqa comment to suppress this error for the gevent monkey patch import, which is intentionally inside a try-except block for conditional loading. This allows the bootstrap generation script to complete successfully. --- .../instrumentation/auto_instrumentation/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py index 1c87d2c327..caac0a5776 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py @@ -149,7 +149,7 @@ def initialize(*, swallow_exceptions: bool = True) -> None: else: try: # pylint: disable=import-outside-toplevel - from gevent import monkey + from gevent import monkey # noqa: PLC0415 getattr(monkey, gevent_patch)() except ImportError: