import os import platform import sys import time from ddtrace import tracer def machine(): """Return type of machine.""" if os.name == 'nt' and sys.version_info[:2] < (2,7): return os.environ.get("PROCESSOR_ARCHITEW6432", os.environ.get('PROCESSOR_ARCHITECTURE', '')) else: return platform.machine() def os_bits(machine=machine()): """Return bitness of operating system, or None if unknown.""" machine2bits = {'AMD64': 64, 'x86_64': 64, 'i386': 32, 'x86': 32} return machine2bits.get(machine, None) def lambda_handler(event, context): print('lets get started') print('machine {}'.format(machine())) with tracer.trace('interesting.operations'): print("GOODNIGHT") time.sleep(5) print("WAKE UP") print('os_bits {}'.format(os_bits())) print('whoop there it is') return { 'statusCode': 200, 'body': 'Hello world extension 18 - python 3.8', 'machine': machine(), 'os_bits': os_bits() }