gpt4 book ai didi

python - AWS X射线 : Cannot create segments inside Lambda function and segment not found

转载 作者:行者123 更新时间:2023-12-01 01:39:50 27 4
gpt4 key购买 nike

我遇到了一个非常奇怪的行为,我正在遵循在线文档,并且在创建一个段来与我的子段一起使用时,lambda 按以下顺序执行:

xray_recorder.begin_segment('segment-name')
xray_recorder.begin_subsegment('subsegment-name')
# put annotations and meta data etc
xray_recorder.end_segment('segment-name')
xray_recorder.end_subsegment('subsegment-name')

但我在 CloudWatch Manager 上收到以下错误:

Cannot create segments inside Lambda function. Discarded.

当我删除段创建并尝试在本地运行时,如下所示:

xray_recorder.begin_subsegment('subsegment-name')
# put annotations and meta data etc
xray_recorder.end_segment('segment-name')

我收到错误:SegmentNotFoundException:找不到当前段/子段,请确保您有一个打开的段

令人困惑。

最佳答案

在本地运行时,xray 段是在本地创建的,您必须启动段来创建子段,但在 AWS 上的 lambda 上运行时,默认情况下会创建段,您可以继续处理子段。

在本地,我在忽略段的创建时遇到了错误,而远程工作却运行良好。

关于python - AWS X射线 : Cannot create segments inside Lambda function and segment not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52002176/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com