elastic / elastic/apm-agent-python

TypeError in elasticapm.context.contextvars

Aperta
#2,056 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub
agent-python community triage
Lingua principale
Python
Stelle
431
Fork
239
Merge medio
5g 10h
PR unite (30g)
7

Descrizione

I'm getting an unhandled TypeError from the set span method of the `elasticapm.context.contextvars.ContextVar` [here](https://github.com/elastic/apm-agent-python/blob/1704ee550b8cc6988f1e8e2770e247ff0c4e9a3f/elasticapm/context/contextvars.py#L82)

The `spans` variable is of type `None` and is throwing an unhandled exception.

I have been unable to find the root causes on this as it is happening in production sporadically without a clear way to reproduce it.

We are running this within a django/celery app with the following version numbers

django: 3.2.24
celery: 5.3.6
apm-agent-python: 6.20.0

Could we possibly add some type guards within this method or exception handling for this case?

Thanks,
Jamie

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in elasticapm/context/contextvars.py, nel metodo dello span ContextVar.set intorno alla riga 82, quindi segui come viene popolato il valore spans nella configurazione Django/Celery descritta. Identifica perché spans può essere None e definisci un caso riproducibile o un test di regressione; il lavoro è completo quando il TypeError sporadico viene evitato o segnalato correttamente, con una copertura per il percorso interessato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
django, python
Ambito
backend, observability-sre
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.