4

I see that I can enable x-ray tracing on my lambda function just by checking a checkbox (or setting Tracing: Active if using SAM). That adds a high level logging.

If I want more detailed logging, my understanding is that I need to add:

from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
patch_all()

however, the xry sdk is not part of lambda. Clearly one of the solutions is to install it with pip install aws-xray-sdk -t . but that will add 42Mb to the function's code.

Is there an alternative solution? thanks

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Diego
  • 34,802
  • 21
  • 91
  • 134
  • What is your original bundle size before adding X-Ray SDK? If this single module design produces a big overhead to your function code, you can open an issue at the SDK repo https://github.com/aws/aws-xray-sdk-python with your use case so it can be properly addressed. – haotian465 Apr 05 '19 at 00:03

2 Answers2

1

Unfortunately the X-Ray Python SDK is written as a single package, and there are no current work arounds to reduce the payload size.

  • This is only true for Python right? The other runtimes like nodejs and java are included as part of the lambda? Where can I read more on this? I couldn't find it from the aws docs – pelican Jun 24 '19 at 13:34
1

You can use lambda layers to bake the X-Ray SDK to your runtime to keep your function code small. See more details on lambda layers https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html. Please let me know if you have extra concerns on using layers.

haotian465
  • 679
  • 3
  • 4