Skip to content

Commit 729f738

Browse files
committed
Fix G002 logging-percent-format
1 parent 984da7d commit 729f738

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

newrelic/hooks/external_aiobotocore.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def wrap_client__make_api_call(wrapped, instance, args, kwargs):
161161
run_bedrock_response_extractor(response_extractor, response_body, bedrock_attrs, is_embedding, transaction)
162162

163163
except Exception:
164-
_logger.warning(RESPONSE_PROCESSING_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
164+
_logger.warning(RESPONSE_PROCESSING_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
165165

166166
return response
167167

newrelic/hooks/external_botocore.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def handle_bedrock_exception(
557557
except json.decoder.JSONDecodeError:
558558
pass
559559
except Exception:
560-
_logger.warning(REQUEST_EXTACTOR_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
560+
_logger.warning(REQUEST_EXTACTOR_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
561561

562562
error_attributes = bedrock_error_attributes(exc, bedrock_attrs)
563563
notice_error_attributes = {
@@ -584,7 +584,7 @@ def handle_bedrock_exception(
584584
else:
585585
handle_chat_completion_event(transaction, error_attributes)
586586
except Exception:
587-
_logger.warning(EXCEPTION_HANDLING_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
587+
_logger.warning(EXCEPTION_HANDLING_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
588588

589589
raise
590590

@@ -594,7 +594,7 @@ def run_bedrock_response_extractor(response_extractor, response_body, bedrock_at
594594
try:
595595
response_extractor(response_body, bedrock_attrs)
596596
except Exception:
597-
_logger.warning(RESPONSE_EXTRACTOR_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
597+
_logger.warning(RESPONSE_EXTRACTOR_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
598598

599599
if is_embedding:
600600
handle_embedding_event(transaction, bedrock_attrs)
@@ -608,7 +608,7 @@ def run_bedrock_request_extractor(request_extractor, request_body, bedrock_attrs
608608
except json.decoder.JSONDecodeError:
609609
pass
610610
except Exception:
611-
_logger.warning(REQUEST_EXTACTOR_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
611+
_logger.warning(REQUEST_EXTACTOR_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
612612

613613

614614
def wrap_bedrock_runtime_invoke_model(response_streaming=False):
@@ -735,7 +735,7 @@ def _wrap_bedrock_runtime_invoke_model(wrapped, instance, args, kwargs):
735735
run_bedrock_response_extractor(response_extractor, response_body, bedrock_attrs, is_embedding, transaction)
736736

737737
except Exception:
738-
_logger.warning(RESPONSE_PROCESSING_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
738+
_logger.warning(RESPONSE_PROCESSING_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
739739

740740
return response
741741

@@ -826,7 +826,7 @@ def record_stream_chunk(self, return_val, transaction):
826826
if _type == "content_block_stop":
827827
record_events_on_stop_iteration(self, transaction)
828828
except Exception:
829-
_logger.warning(RESPONSE_EXTRACTOR_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
829+
_logger.warning(RESPONSE_EXTRACTOR_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
830830

831831

832832
def record_events_on_stop_iteration(self, transaction):
@@ -842,7 +842,7 @@ def record_events_on_stop_iteration(self, transaction):
842842
bedrock_attrs["duration"] = self._nr_ft.duration * 1000
843843
handle_chat_completion_event(transaction, bedrock_attrs)
844844
except Exception:
845-
_logger.warning(RESPONSE_PROCESSING_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
845+
_logger.warning(RESPONSE_PROCESSING_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
846846

847847
# Clear cached data as this can be very large.
848848
self._nr_bedrock_attrs.clear()
@@ -878,7 +878,7 @@ def record_error(self, transaction, exc):
878878
# Clear cached data as this can be very large.
879879
error_attributes.clear()
880880
except Exception:
881-
_logger.warning(EXCEPTION_HANDLING_FAILURE_LOG_MESSAGE % traceback.format_exception(*sys.exc_info()))
881+
_logger.warning(EXCEPTION_HANDLING_FAILURE_LOG_MESSAGE, traceback.format_exception(*sys.exc_info()))
882882

883883

884884
def handle_embedding_event(transaction, bedrock_attrs):

0 commit comments

Comments
 (0)