python - 如何使用 Python 中的 AWS Lambda 函数检测 X-Ray 中的其他函数?
问题描述
我正在尝试使用 X Ray 检测 AWS Lambda 函数。根据官方文档,aws_xray_sdk
我无法检测处理函数之外的任何内容。如果我有以下示例代码:
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
X 射线跟踪中除了handler
. 我尝试过使用不同的组合begin_subsegment
并且没有@xray_recorder.capture()
on my_function
。似乎没有任何迹象为my_function
. 我该如何解决这个问题?
解决方案
请尝试改变
xray_recorder.end_subsegment("my_function")
到
xray_recorder.end_subsegment()
推荐阅读
- hibernate-5 - hibernate 5 HQL 中的日期函数
- model-view-controller - Sitefinity 12.2 MVC-向工具栏添加功能
- javascript - 返回错误valid()的JS函数不是函数吗?
- python - 如何在 Angular 和 django 中进行并行处理
- javascript - 使引导行在列内占据全高
- python - 使用机器学习记录可能性
- python - 当我们在X轴上有日期时如何在python中绘制等高线图
- android - 带有 BottomSheetBehaviour 的 MotionLayout 中的 RecyclerView 在触摸 RecyclerView 时不会滚动
- react-native - 使用此命令安装 expo 时出错 (npm install expo-cli --global)
- python - 使用 cGAN 模型生成图像