-
Notifications
You must be signed in to change notification settings - Fork 140
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
Replace slow json filename resolver #306
Merged
NathanielRN
merged 3 commits into
aws:master
from
NathanielRN:remove-slow-filepath-resolve
Jul 28, 2021
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"version": 2, | ||
"default": { | ||
"fixed_target": 1, | ||
"rate": 0.05 | ||
}, | ||
"rules": [ | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import json | ||
import pkgutil | ||
from pkg_resources import resource_filename | ||
|
||
from aws_xray_sdk.core.sampling.local.sampler import LocalSampler | ||
|
||
def test_pkg_resources_static_read(benchmark): | ||
def get_sampling_rule(): | ||
with open(resource_filename(__name__, 'mock_sampling_rule.json')) as f: | ||
return json.load(f) | ||
benchmark(get_sampling_rule) | ||
|
||
def test_pkgutil_static_read(benchmark): | ||
def get_sampling_rule(): | ||
json.loads(pkgutil.get_data(__name__, 'mock_sampling_rule.json')) | ||
benchmark(get_sampling_rule) | ||
This file contains 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
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.
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.
These tests are really testing the performance of standard library functions (
pkgutil
andpkg_resources
) instead of testingaws-xray-sdk-python
functions.For that reason I think we should not include them here? The PR comment can serve as proof that this change is worth it.
Otherwise, we can leave the tests here so the results can be reproduced later.
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.
Agree with deleting these benchmarks (first thing that came to mind but keeping them also isn't a big deal)