getsentry / getsentry/sentry-python

Had to manually create a transaction to see agent spans when using `asyncio.create_task`

未關閉
#5,989 3 則留言 0 個 reaction 已指派 1 人 已被 @alexander-alderman-webb 認領 在 GitHub 檢視
Improvement Python
主要語言
Python
星號
2.2k
分支
669
平均合併
1 天 1 小時
30 天內合併 PR
213

描述

Some asyncio tasks outlive the transaction that was running when they were created, and the spans they create are never sent.

Fabian: Investigated the issue. `create_task` is like spawning a thread that lives longer than the transaction of the HTTP server. So without a manual transaction, the HTTP server transaction is already closed before the agent can add spans to it, resulting in the span being dropped without notice.

Solutions:
- Span first will send the trailing spans -- but will the pipeline support storing and showing them, especially if they come quite late after the transaction finishes?
- Native support for background tasks like https://github.com/getsentry/sentry-python/issues/1473
- Wrap in a manual transaction

_Copied from https://linear.app/getsentry/issue/PY-2292/had-to-manually-create-a-transaction-to-see-agent-spans-when-using which didn't get synced to GH_

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。