Merged
Conversation
* Rearrange `try/except` so `stop_span()` will only be called if it was started * Use and test the full `user_ip` algorithm rather than just `request.remote_addr`, and reduce scope of its `try/except` * Improve some tests
dlanderson
approved these changes
Jun 27, 2019
| tr.tag("ignore_transaction", True) | ||
| tracked_request.tag("ignore_transaction", True) | ||
|
|
||
| tracked_request.tag("path", request.path) |
Contributor
There was a problem hiding this comment.
Any reason we moved this outside the try? .path should supposedly always be present, but it's not critical in order for the TrackedRequest to work, and there's no harm in having it within the try where we do user_ip as well, right?
Contributor
Author
There was a problem hiding this comment.
request.path was already accessed outside of the try above - when I started writing a test to make it crash, I realized this.
adamchainz
added a commit
that referenced
this pull request
Jun 29, 2019
After looking at whether this is needed in all tests for non-tracking, I realized this is already done for each test by the `isolate_global_state` fixture in `tests/conftest.py`. Therefore removing the redundant assertions added in #195.
adamchainz
added a commit
that referenced
this pull request
Jun 29, 2019
After looking at whether this is needed in all tests for non-tracking, I realized this is already done for each test by the `isolate_global_state` fixture in `tests/conftest.py`. Therefore removing the redundant assertions added in #195.
adamchainz
added a commit
that referenced
this pull request
Oct 23, 2019
Both the Bottle and Pyramid integrations have this overly cautious behaviour around reading headers from the upstream framework. They both assume that basic framework operations such as fetching a header can fail, and guard around it. Some of this came from my refactoring for Bottle in #192 and Pyramid in #195, where I narrowed large `try/except` blocks down, but didn't rethink this paranoia. I think this is too cautious and can be removed. It required a lot of extra lines for the two frameworks when adding Amazon request queue timing in #279, to really no extra effect. If fetching headers (with safe defaults) is broken, users' applications are pretty much guaranteed to be broken too.
adamchainz
added a commit
that referenced
this pull request
Oct 23, 2019
Both the Bottle and Pyramid integrations have this overly cautious behaviour around reading headers from the upstream framework. They both assume that basic framework operations such as fetching a header can fail, and guard around it. Some of this came from my refactoring for Bottle in #192 and Pyramid in #195, where I narrowed large `try/except` blocks down, but didn't rethink this paranoia. I think this is too cautious and can be removed. It required a lot of extra lines for the two frameworks when adding Amazon request queue timing in #279, to really no extra effect. If fetching headers (with safe defaults) is broken, users' applications are pretty much guaranteed to be broken too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
try/exceptsostop_span()will only be called if it was starteduser_ipalgorithm rather than justrequest.remote_addr, and reduce scope of itstry/except