Skip to content

Commit f6436f8

Browse files
committed
patch release commit
1 parent 0199e15 commit f6436f8

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
CHANGELOG
33
=========
44

5+
2.0.1
6+
=====
7+
* bugfix: Fixed a issue where manually `begin_segment` might break when making sampling decisions. `PR82 <https://github.com/aws/aws-xray-sdk-python/pull/82>`_.
8+
59
2.0.0
610
=====
711
* **Breaking**: The default sampler now launches background tasks to poll sampling rules from X-Ray backend. See the new default sampling strategy in more details here: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-python-configuration.html#xray-sdk-python-configuration-sampling.

aws_xray_sdk/core/sampling/sampler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def should_trace(self, sampling_req=None):
5757
now = int(time.time())
5858
if sampling_req and not sampling_req.get('service_type', None):
5959
sampling_req['service_type'] = self._origin
60+
elif sampling_req is None:
61+
sampling_req = {'service_type': self._origin}
6062
matched_rule = self._cache.get_matched_rule(sampling_req, now)
6163
if matched_rule:
6264
log.debug('Rule %s is selected to make a sampling decision.', matched_rule.name)

aws_xray_sdk/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '2.0'
1+
VERSION = '2.0.1'

tests/test_recorder.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,11 @@ def my_func():
112112

113113
actual = my_func()
114114
assert actual == value
115+
116+
117+
def test_first_begin_segment_sampled():
118+
xray_recorder = get_new_stubbed_recorder()
119+
xray_recorder.configure(sampling=False)
120+
segment = xray_recorder.begin_segment('name')
121+
122+
assert segment.sampled

0 commit comments

Comments
 (0)