Handle "LogRecord.exc_info" being a string#4699
Handle "LogRecord.exc_info" being a string#4699jourdanrodrigues wants to merge 6 commits intoopen-telemetry:mainfrom
Conversation
| attributes[code_attributes.CODE_FUNCTION_NAME] = record.funcName | ||
| attributes[code_attributes.CODE_LINE_NUMBER] = record.lineno | ||
|
|
||
| if isinstance(record.exc_info, str): |
There was a problem hiding this comment.
Should we add a comment here to explain the motivation?
There was a problem hiding this comment.
I wasn't able to track down why nor how this happens (I tried as hard as I could), like if this was some misconfiguration in my work's project or some lib doing this, and I left such comment in the test that preserves this behavior.
Unfortunately, the only thing I know is that it can be a string and this fixed it in my case.
There was a problem hiding this comment.
Perhaps a line explaining the motivation would help readers? Doesn't have to be specific, just that the check and overwrite are defensive, preventing errors in some implementations.
There was a problem hiding this comment.
@jourdanrodrigues are you setting any kind of logging.Filter in the LoggingHandler?
|
This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment. |
|
This PR has been closed due to inactivity. Please reopen if you would like to continue working on it. |
Description
Faced random logs at work that had
LogRecord.exc_infoset to a string. Couldn't track down where it came from so I monkey-patched it in my project.Decided to propose here in case this is of interest to include in the lib.
Type of change
How Has This Been Tested?
opentelemetry-sdk/tests/logs/test_handler.pyDoes This PR Require a Contrib Repo Change?
Checklist: