Skip to content

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

Merged
merged 16 commits into from
Sep 14, 2020

Conversation

lzchen
Copy link
Contributor

@lzchen lzchen commented Sep 9, 2020

Part of #1057

The test util was also missing a dependency to the sdk package, which it uses

@lzchen lzchen requested a review from a team September 9, 2020 15:52
Copy link
Contributor

@codeboten codeboten left a 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

@codeboten codeboten added the release:required-for-ga To be resolved before GA release label Sep 9, 2020
result = self.perform_request(self.URL)
self.assertEqual(result.text, "Hello!")

span = self.assert_span(None, 0)
Copy link
Member

@aabmass aabmass Sep 11, 2020

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

Comment on lines 164 to 166
with self.assertRaises(AttributeError):
# pylint: disable=pointless-statement
mock_span.attributes
Copy link
Member

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?

@lzchen lzchen merged commit d376df1 into open-telemetry:master Sep 14, 2020
@lzchen lzchen deleted the record branch September 14, 2020 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:required-for-ga To be resolved before GA release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants