diff --git a/aws_xray_sdk/ext/resources/aws_para_whitelist.json b/aws_xray_sdk/ext/resources/aws_para_whitelist.json index bc6642a0..3a89b2e7 100644 --- a/aws_xray_sdk/ext/resources/aws_para_whitelist.json +++ b/aws_xray_sdk/ext/resources/aws_para_whitelist.json @@ -1,5 +1,14 @@ { "services": { + "sns": { + "operations": { + "Publish": { + "request_parameters": [ + "TopicArn" + ] + } + } + }, "dynamodb": { "operations": { "BatchGetItem": { diff --git a/tests/ext/botocore/test_botocore.py b/tests/ext/botocore/test_botocore.py index 8d48785f..f006de2f 100644 --- a/tests/ext/botocore/test_botocore.py +++ b/tests/ext/botocore/test_botocore.py @@ -150,3 +150,26 @@ def test_pass_through_on_context_missing(): assert result is not None xray_recorder.configure(context_missing='RUNTIME_ERROR') + + +def test_sns_publish_parameters(): + sns = session.create_client('sns', region_name='us-west-2') + response = { + 'ResponseMetadata': { + 'RequestId': REQUEST_ID, + 'HTTPStatusCode': 200, + } + } + + with Stubber(sns) as stubber: + stubber.add_response('publish', response, {'TopicArn': 'myAmazingTopic', 'Message': 'myBodaciousMessage'}) + sns.publish(TopicArn='myAmazingTopic', Message='myBodaciousMessage') + + subsegment = xray_recorder.current_segment().subsegments[0] + assert subsegment.http['response']['status'] == 200 + + aws_meta = subsegment.aws + assert aws_meta['topic_arn'] == 'myAmazingTopic' + assert aws_meta['request_id'] == REQUEST_ID + assert aws_meta['region'] == 'us-west-2' + assert aws_meta['operation'] == 'Publish'