-
Notifications
You must be signed in to change notification settings - Fork 711
Adding warning to log/log_event calls #255
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
Conversation
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.
LGTM with only minor comments, welcome to the project!
self.assertEqual( | ||
span.unwrap().events[0].attributes["event"], "foo" | ||
) | ||
self.assertEqual( | ||
span.unwrap().events[0].attributes["payload"], "bar" | ||
) | ||
self.assertIsNotNone(span.unwrap().events[0].timestamp) |
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.
Any reason for these to be inside the context manager?
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.
There is not. I just copied the test_log_kv format. Will update
@@ -77,6 +77,14 @@ def log_kv(self, key_values, timestamp=None): | |||
self._otel_span.add_event(event_name, event_timestamp, key_values) | |||
return self | |||
|
|||
def log(self, **kwargs): | |||
logger.warning("Calling deprecated method log") |
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.
Good reminder that we should consider deprecated
for this kind of thing.
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.
Can do, you want me to add Deprecated as an install dependency of the shim?
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.
Sorry, I didn't mean to suggest any action in this PR, just a reminder that we might want to do this in the future.
We talked about adding the library earlier but didn't yet have a good use case for it. This might be a good use case.
Tested that calling log/log_event worked without implementing them. The implementation is strictly to log a warning when those deprecated methods are called. - Use deprecated instead of logging directly Signed-off-by: Alex Boten <[email protected]>
@@ -77,6 +78,14 @@ def log_kv(self, key_values, timestamp=None): | |||
self._otel_span.add_event(event_name, event_timestamp, key_values) | |||
return self | |||
|
|||
@deprecated(reason="This method is deprecated in favor of log_kv") |
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 feel we should add these to opentracing
itself too ;) )
Signed-off-by: Alex Boten <[email protected]>
I signed it |
Tested that calling log/log_event worked without implementing them. The implementation is strictly to log a warning when those deprecated methods are called.
Signed-off-by: Alex Boten [email protected]