-
Notifications
You must be signed in to change notification settings - Fork 698
Use is_recording flag in requests instrumentation #1087
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.
Change looks good, just a question I'd like answered in the test before moving to approving. Also github is making this look like a much bigger change than it is
instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py
Outdated
Show resolved
Hide resolved
result = self.perform_request(self.URL) | ||
self.assertEqual(result.text, "Hello!") | ||
|
||
span = self.assert_span(None, 0) |
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.
Looks to me like this would pass regardless of the code change since the result isn't actually different, which is fine if this behavior wasn't checked before.
But also patching (I think) opentelemetry.trace.INVALID_SPAN
and then checking that is_recording()
was called, set_attribute()
was never called, etc. would be good to verify this PR's behavior
with self.assertRaises(AttributeError): | ||
# pylint: disable=pointless-statement | ||
mock_span.attributes |
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 the AttributeError
is only raised because of autospec=True
?
Part of #1057
The test util was also missing a dependency to the sdk package, which it uses