Skills covered: 4.1.2, 4.2.4, 4.2.6
from aws_xray_sdk.core import xray_recorder, patch_all
patch_all()
def handler(event, context):
xray_recorder.current_subsegment().put_annotation('userId', 'user-123')
xray_recorder.current_subsegment().put_metadata('details', {'amount': 100})
with xray_recorder.in_subsegment('ProcessOrder'):
pass # business logic