Xray not capturing stack traces in latest version of Flask
@srprash 已经在做这个了。
开始于 2021年1月26日。
评估
这个 Issue 还没有评估数据。
描述
The after_request handler is closing the segment before the teardown_request handler is called so the stack trace isn't captured.
It looks like this behavior changed as of Flask v1.1.0 (specifically https://github.com/pallets/flask/pull/3266)
Currently using:
- aws-xray-sdk v2.6.0
- flask v1.1.2
Here is our current work around:
app = Flask(__name__)
def wrap_exception_handler(handler):
def wrapped_function(exp):
if not isinstance(exp, HTTPException) or exp.code >= 500:
try:
stack = stacktrace.get_stacktrace(
limit=xray_recorder.max_trace_back,
)
xray_recorder.current_segment().add_exception(exp, stack)
except Exception:
app.logger.error('Failed to add stack trace to xray segment')
return handler(exp)
return wrapped_function
app.handle_user_exception = wrap_exception_handler(app.handle_user_exception)
- 主要语言
- Python
- 星标
- 340
- 派生
- 148
- 平均合并
- 7 天 8 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-xray-sdk-python 的其他 Issue
-
psycopg connection context manager drops X-Ray tracing wrapper, so cursor execute calls are not traced可能已有人在做 @reginaldalfret 于 23 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
aws/aws-xray-sdk-python#490 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 1/100
aws/aws-xray-sdk-python#460 ·
-
Next release未关闭
难度 5/5 一周以上 新手友好度 20/100
aws/aws-xray-sdk-python#457 · 1 个 reaction ·
-
mysql-connector 9.2.0 - TypeError: 'MySQLConnection' object is not iterable可能已有人在做 @reginaldalfret 于 23 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
aws/aws-xray-sdk-python#453 ·
-
难度 4/5 3-5 天 新手友好度 35/100
aws/aws-xray-sdk-python#452 · 1 个 reaction ·
查看 aws/aws-xray-sdk-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 68/100
collective/icalendar#1968 · 1 条评论 ·
维护者通常 1 天内回复
-
Deferred from #1869: Complete the companion pytest guardrail update noted in the PR description...未关闭
难度 1/5 1 小时以内 新手友好度 95/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
NousResearch/hermes-agent#140958 ·
维护者通常 1 天内回复
-
Bug triage/confirmed
难度 2/5 半天 新手友好度 85/100
agentscope-ai/agentscope#3355 ·
维护者通常 2 天内回复