INNER CODE UNIT · Python
index
aws-samples/aws-workshop-for-kubernetes · 03-path-application-development/306-app-tracing-with-jaeger-and-x-ray/x-ray/python-flask-app/app.py:44
def index(number=1):
result = fib(number)
return "Python Fib("+ str(number) + "): " + str(result)
@xray_recorder.capture('Fibonnaci')
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)