Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL: Add traceback logs in sfp.py for troubleshooting EEPROM read issues #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import os
import threading
import time
import traceback
from sonic_py_common.logger import Logger
from sonic_py_common.general import check_output_pipe
from . import utils
Expand Down Expand Up @@ -541,6 +542,19 @@ def _read_eeprom(self, offset, num_bytes, log_on_error=True):
if log_on_error:
logger.log_warning(f'Failed to read sfp={self.sdk_index} EEPROM page={page}, page_offset={page_offset}, '\
f'size={num_bytes}, offset={offset}, error = {e}')

logger.log_error(f"--- tomer --- {self.sdk_index}: Entered monitored if statement")
logger.log_error(f"--- tomer --- {self.sdk_index}: Stack trace leading to this call:")
stack = traceback.extract_stack()
for frame in stack:
logger.log_error(f"--- tomer --- {self.sdk_index}: File: {frame.filename}")
logger.log_error(f"--- tomer --- {self.sdk_index}: Line number: {frame.lineno}")
logger.log_error(f"--- tomer --- {self.sdk_index}: Function name: {frame.name}")
logger.log_error(f"--- tomer --- {self.sdk_index}: Line of code: {frame.line}")
logger.log_error('-' * 40)
logger.log_error('-' * 40)
logger.log_error('-' * 40)

return None

return bytearray(result)
Expand Down