Skip to content

Commit 3038610

Browse files
committed
Fixed leftover poller threads on CI
1 parent 452cb82 commit 3038610

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CHANGELOG
88
* feature: Added support for `pynamodb` >= 3.3.1. `PR88 <https://github.com/aws/aws-xray-sdk-python/pull/88>`_.
99
* improvement: Improved stack trace recording when exception is thrown in decorators. `PR70 <https://github.com/aws/aws-xray-sdk-python/pull/70>`_.
1010
* bugfix: Argument `sampling_req` in LocalSampler `should_trace` method now becomes optional. `PR89 <https://github.com/aws/aws-xray-sdk-python/pull/89>`_.
11-
* bugfix: Fixed a wrong test setup in recorder unit test.
11+
* bugfix: Fixed a wrong test setup and leftover poller threads in recorder unit test.
1212

1313
2.0.1
1414
=====

aws_xray_sdk/ext/botocore/patch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def patch():
3030
def _xray_traced_botocore(wrapped, instance, args, kwargs):
3131
service = instance._service_model.metadata["endpointPrefix"]
3232
if service == 'xray':
33-
# skip tracing for SDK built-in centralized sampling pollers
34-
if 'GetCentralizedSamplingRules' in args or 'GetSamplingTargets' in args:
33+
# skip tracing for SDK built-in sampling pollers
34+
if 'GetSamplingRules' in args or 'GetSamplingTargets' in args:
3535
return wrapped(*args, **kwargs)
3636
return xray_recorder.record_subsegment(
3737
wrapped, instance, args, kwargs,

tests/util.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from aws_xray_sdk.core.recorder import AWSXRayRecorder
66
from aws_xray_sdk.core.emitters.udp_emitter import UDPEmitter
7+
from aws_xray_sdk.core.sampling.sampler import DefaultSampler
78
from aws_xray_sdk.core.utils.compat import PY35
89

910

@@ -26,6 +27,12 @@ def pop(self):
2627
return entity
2728

2829

30+
class StubbedSampler(DefaultSampler):
31+
32+
def start(self):
33+
pass
34+
35+
2936
def get_new_stubbed_recorder():
3037
"""
3138
Returns a new AWSXRayRecorder object with emitter stubbed
@@ -36,7 +43,7 @@ def get_new_stubbed_recorder():
3643
from aws_xray_sdk.core.async_recorder import AsyncAWSXRayRecorder
3744
recorder = AsyncAWSXRayRecorder()
3845

39-
recorder.emitter = StubbedEmitter()
46+
recorder.configure(emitter=StubbedEmitter(), sampler=StubbedSampler())
4047
return recorder
4148

4249

0 commit comments

Comments
 (0)