Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 2 commits into from
Oct 31, 2019
Merged

Conversation

codeboten
Copy link
Contributor

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]

Copy link
Member

@c24t c24t left a 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!

Comment on lines 413 to 419
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)
Copy link
Member

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?

Copy link
Contributor Author

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")
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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")
Copy link
Contributor

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 ;) )

@codeboten
Copy link
Contributor Author

I signed it

@c24t c24t merged commit e53edd5 into open-telemetry:master Oct 31, 2019
@codeboten codeboten deleted the shim-log branch October 6, 2020 15:34
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants