diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py index 4a809cddc81..6b4cc01af79 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py @@ -117,8 +117,9 @@ def _get_temporality( _logger.warning( "Unrecognized OTEL_EXPORTER_METRICS_TEMPORALITY_PREFERENCE" " value found: " - f"{otel_exporter_otlp_metrics_temporality_preference}, " - "using CUMULATIVE" + "%s, " + "using CUMULATIVE", + otel_exporter_otlp_metrics_temporality_preference, ) instrument_class_temporality = { Counter: AggregationTemporality.CUMULATIVE, diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py index 4be75c5335e..79270b99a0c 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py @@ -125,7 +125,8 @@ def _read_file(file_path: str) -> Optional[bytes]: return file.read() except FileNotFoundError as e: logger.exception( - f"Failed to read file: {e.filename}. Please check if the file exists and is accessible." + "Failed to read file: %s. Please check if the file exists and is accessible.", + e.filename, ) return None diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/error_handler/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/error_handler/__init__.py index 3e0e778f1ae..d58c9003c7e 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/error_handler/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/error_handler/__init__.py @@ -130,8 +130,7 @@ def __exit__(self, exc_type, exc_value, traceback): # pylint: disable=broad-exception-caught except Exception as error_handling_error: logger.exception( - "%s error while handling error" - " %s by error handler %s", + "%s error while handling error %s by error handler %s", error_handling_error.__class__.__name__, exc_value.__class__.__name__, error_handler_class.__name__, diff --git a/pyproject.toml b/pyproject.toml index 51c60260a21..ba590c2758e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,6 +77,7 @@ select = [ "PLC", # pylint convention "PLE", # pylint error "Q", # flake8-quotes + "G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g ] ignore = [