getsentry / getsentry/sentry-python

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

Aberta
#5,989 3 comentários 0 reações 1 responsável Reivindicada por @alexander-alderman-webb Ver no GitHub
Improvement Python
Linguagem predominante
Python
Estrelas
2.2k
Forks
669
Merge médio
1d 1h
PRs com merge (30d)
213

Descrição

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_

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.