【发布时间】:2020-10-20 20:35:54
【问题描述】:
我正在尝试使用 X Ray 检测 AWS Lambda 函数。根据aws_xray_sdk 的official documentation,我无法检测处理函数之外的任何内容。如果我有以下示例代码:
from aws_xray_sdk.core import xray_recorder
@xray_recorder.capture("handler")
def my_handler(event, context):
# some code here
xray_recorder.begin_subsegment("my_function")
my_function(params)
xray_recorder.end_subsegment("my_function")
return {"message": "done"}
@xray_recorder.capture("my_function")
def my_function(params):
# do work
除了handler 之外,X 射线跟踪中没有检测到任何内容。我尝试了begin_subsegment 的不同组合,而my_function 上没有@xray_recorder.capture()。 my_function 似乎没有任何痕迹。我该如何解决这个问题?
【问题讨论】:
标签: python amazon-web-services aws-lambda aws-xray