Skip to content

Commit b47f1e8

Browse files
authored
Merge pull request #205 from srprash/master
streaming_threshold not None check. Also dropping `loop` parameter from aiobotocore tests.
2 parents 37e57bb + 9b2704d commit b47f1e8

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

aws_xray_sdk/core/recorder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class to have your own implementation of the streaming process.
159159
self.dynamic_naming = dynamic_naming
160160
if streaming:
161161
self.streaming = streaming
162-
if streaming_threshold:
162+
if streaming_threshold is not None:
163163
self.streaming_threshold = streaming_threshold
164164
if type(max_trace_back) == int and max_trace_back >= 0:
165165
self.max_trace_back = max_trace_back

tests/ext/aiobotocore/test_aiobotocore.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async def test_describe_table(loop, recorder):
2828
req_id = '1234'
2929
response = {'ResponseMetadata': {'RequestId': req_id, 'HTTPStatusCode': 403}}
3030

31-
session = aiobotocore.get_session(loop=loop)
31+
session = aiobotocore.get_session()
3232
async with session.create_client('dynamodb', region_name='eu-west-2') as client:
3333
with Stubber(client) as stubber:
3434
stubber.add_response('describe_table', response, {'TableName': 'mytable'})
@@ -53,7 +53,7 @@ async def test_s3_parameter_capture(loop, recorder):
5353
version_id = 'myversionid'
5454
response = {'ResponseMetadata': {'RequestId': '1234', 'HTTPStatusCode': 200}}
5555

56-
session = aiobotocore.get_session(loop=loop)
56+
session = aiobotocore.get_session()
5757
async with session.create_client('s3', region_name='eu-west-2') as client:
5858
with Stubber(client) as stubber:
5959
stubber.add_response('get_object', response,
@@ -87,7 +87,7 @@ async def test_list_parameter_counting(loop, recorder):
8787
}
8888
}
8989

90-
session = aiobotocore.get_session(loop=loop)
90+
session = aiobotocore.get_session()
9191
async with session.create_client('sqs', region_name='eu-west-2') as client:
9292
with Stubber(client) as stubber:
9393
stubber.add_response('list_queues', response, {'QueueNamePrefix': queue_name_prefix})
@@ -117,7 +117,7 @@ async def test_map_parameter_grouping(loop, recorder):
117117
}
118118
}
119119

120-
session = aiobotocore.get_session(loop=loop)
120+
session = aiobotocore.get_session()
121121
async with session.create_client('dynamodb', region_name='eu-west-2') as client:
122122
with Stubber(client) as stubber:
123123
stubber.add_response('batch_write_item', response, {'RequestItems': ANY})
@@ -137,7 +137,7 @@ async def test_context_missing_not_swallow_return(loop, recorder):
137137

138138
response = {'ResponseMetadata': {'RequestId': '1234', 'HTTPStatusCode': 403}}
139139

140-
session = aiobotocore.get_session(loop=loop)
140+
session = aiobotocore.get_session()
141141
async with session.create_client('dynamodb', region_name='eu-west-2') as client:
142142
with Stubber(client) as stubber:
143143
stubber.add_response('describe_table', response, {'TableName': 'mytable'})
@@ -150,7 +150,7 @@ async def test_context_missing_not_suppress_exception(loop, recorder):
150150
xray_recorder.configure(service='test', sampling=False,
151151
context=AsyncContext(loop=loop), context_missing='LOG_ERROR')
152152

153-
session = aiobotocore.get_session(loop=loop)
153+
session = aiobotocore.get_session()
154154
async with session.create_client('dynamodb', region_name='eu-west-2') as client:
155155
with Stubber(client) as stubber:
156156
stubber.add_client_error('describe_table', expected_params={'TableName': ANY})

tests/test_recorder.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ def test_subsegments_streaming():
7474
assert xray_recorder.current_subsegment().name == '9'
7575

7676

77+
def test_subsegment_streaming_set_zero():
78+
xray_recorder.configure(streaming_threshold=0)
79+
segment = xray_recorder.begin_segment('name')
80+
xray_recorder.begin_subsegment(name='sub')
81+
xray_recorder.end_subsegment()
82+
83+
assert xray_recorder.streaming.streaming_threshold == 0
84+
assert segment.get_total_subsegments_size() == 0
85+
86+
7787
def test_put_annotation_metadata():
7888
segment = xray_recorder.begin_segment('name')
7989
xray_recorder.put_annotation('key1', 'value1')

0 commit comments

Comments
 (0)