Skip to content

Commit 34b3ac6

Browse files
adding logging format lint check (#4525)
* adding logging format lint check * changes from ruff format command * reapplying format changes changes --------- Co-authored-by: Riccardo Magliocchetti <[email protected]>
1 parent 9b5af99 commit 34b3ac6

File tree

4 files changed

+7
-5
lines changed
  • exporter
    • opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder
    • opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc
  • opentelemetry-sdk/src/opentelemetry/sdk/error_handler

4 files changed

+7
-5
lines changed

exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ def _get_temporality(
117117
_logger.warning(
118118
"Unrecognized OTEL_EXPORTER_METRICS_TEMPORALITY_PREFERENCE"
119119
" value found: "
120-
f"{otel_exporter_otlp_metrics_temporality_preference}, "
121-
"using CUMULATIVE"
120+
"%s, "
121+
"using CUMULATIVE",
122+
otel_exporter_otlp_metrics_temporality_preference,
122123
)
123124
instrument_class_temporality = {
124125
Counter: AggregationTemporality.CUMULATIVE,

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def _read_file(file_path: str) -> Optional[bytes]:
125125
return file.read()
126126
except FileNotFoundError as e:
127127
logger.exception(
128-
f"Failed to read file: {e.filename}. Please check if the file exists and is accessible."
128+
"Failed to read file: %s. Please check if the file exists and is accessible.",
129+
e.filename,
129130
)
130131
return None
131132

opentelemetry-sdk/src/opentelemetry/sdk/error_handler/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ def __exit__(self, exc_type, exc_value, traceback):
130130
# pylint: disable=broad-exception-caught
131131
except Exception as error_handling_error:
132132
logger.exception(
133-
"%s error while handling error"
134-
" %s by error handler %s",
133+
"%s error while handling error %s by error handler %s",
135134
error_handling_error.__class__.__name__,
136135
exc_value.__class__.__name__,
137136
error_handler_class.__name__,

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ select = [
7777
"PLC", # pylint convention
7878
"PLE", # pylint error
7979
"Q", # flake8-quotes
80+
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
8081
]
8182

8283
ignore = [

0 commit comments

Comments
 (0)