temporalio / temporalio/sdk-python
[Feature Request] Loss of stack trace information
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 1.2k
- Fork
- 241
- Merge medio
- 3g 21h
- PR unite (30g)
- 55
Descrizione
Is your feature request related to a problem? Please describe.
- I would like to include full stack trace information in Sentry - see screenshot below where only
ChildWorkflowErrorhas a stack trace and bothActivityErrorandApplicationErrorare missing it. - I understand the exceptions are passed through the distributed system using the
FailureProtobuf message which has astack_tracefield which could be used to populate the Sentry stack trace. This works for getting the stack trace of theApplicationErrorin the activity. However, it's impossible to get the stack trace for theActivityErrorin theTestChildWorkflowbecause the failure is just copied from the original failure here: https://github.com/temporalio/sdk-python/blob/bf747f1170e603b1e1adbd77c673fa83f0c99e7d/temporalio/converter.py#L826-L829
This is the workflow and activity code I'm using to test this:
@activity.defn(...)
async def test_activity() -> None:
raise TestException("Test error")
@workflow.defn
class TestChildWorkflow:
@workflow.run
async def run(self) -> None:
# execute_default_activity is our wrapper around workflow.execute_activity
await execute_default_activity(
test_activity,
retry_policy=RetryPolicy(maximum_attempts=1),
),
@workflow.defn
class TestParentWorkflow:
@workflow.run
async def run(self) -> None:
# child workflow fails parent workflow
await workflow.execute_child_workflow(
TestChildWorkflow.run,
id=f"test-child-workflow-{int(workflow.time())}",
task_queue=get_temporal_tasks_queue_name(),
)
Describe the solution you'd like
- Ability to get the stack trace for every error in the chain. I am happy to contribute this code but I am not sure if there is a strong reason for why it is done this way and whether it can be changed.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in temporalio/converter.py, intorno alle righe 826-829, dove viene copiata l’eccezione, e riproduci il problema con gli entry point TestParentWorkflow, TestChildWorkflow e test_activity. Traccia come stack_trace di Failure Protobuf attraversa la catena ActivityError e ChildWorkflowError. Il lavoro è completo quando Sentry può accedere alle informazioni dello stack trace per ogni errore nella catena senza perdere la traccia originale dell’attività.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- distributed-systems, observability
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100