Skip to content

Instantly share code, notes, and snippets.

@mwacc
Created February 20, 2019 05:10
Show Gist options
  • Save mwacc/b9f07e94fc3be411feac95a6a2280806 to your computer and use it in GitHub Desktop.
Save mwacc/b9f07e94fc3be411feac95a6a2280806 to your computer and use it in GitHub Desktop.
from aws_xray_sdk.core import xray_recorder
@xray_recorder.capture('transfer_funds')
def money_transfer(from_acc_id, to_acc_id, value):
xray_recorder.begin_subsegment('lock_funds')
money_locked = enough_and_lock(from_acc_id, value)
xray_recorder.end_subsegment()
if money_locked:
xray_recorder.begin_subsegment('transfer funds via ' + money_locked.payment_gateway)
transfer_funds(from_acc_id, to_acc_id, value)
xray_recorder.end_subsegment()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment