elastic / elastic/apm-agent-python
TypeError in elasticapm.context.contextvars
- Dominant language
- Python
- Stars
- 431
- Forks
- 239
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 7
Description
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
Contributor guide
Assessment
This issue has not been assessed yet.