-
Notifications
You must be signed in to change notification settings - Fork 563
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
log the attribute's key when encoding an attribute fails #3838
base: main
Are you sure you want to change the base?
log the attribute's key when encoding an attribute fails #3838
Conversation
|
@danielhochman you have to sign the CLA for contributing to OpenTelemetry |
) | ||
def test_encode_attributes_error_logs_key(self, mock_logger_exception): | ||
result = _encode_attributes({"a": 1, "bad_key": None, "b": 2}) | ||
mock_logger_exception.assert_called_once() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's no need to mock. What do you think about use assertLogs instead of this? and also assert the len of the log records?
self.assertEqual( | ||
mock_logger_exception.call_args_list[0].args[1], "bad_key" | ||
) | ||
self.assertTrue( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of assertIsInstance?
Description
Include the attribute key that failed to encode. Very hard to track down otherwise.
Before
After
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: