in api/handler.py [0:0]
def lambda_handler(event, context):
success = True
rule = get_api_sampling_rule()
iserror='false'
try:
iserror=event['queryStringParameters']['error']
except:
print("shh.. do not tell anyone!!")
if iserror == 'true':
success = False
return {
# fail the request randomly to trigger X-Ray rule adjustment
"statusCode": 200 if success else 500,
"body": json.dumps({
"Success" : success,
# return the rule definition to the response
"SamplingRule": rule
}, indent=2)
}