Make annotations available in the thread_state
Open
discussion
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 778
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 3
Description
The following is a useful code that Dask distributed provides to get the key from a task, inside the task code:
```python
from distributed.worker import thread_state
task_key = thread_state.key
```
I would like to suggest making the annotations available using the same mechanism:
```python
from distributed.worker import thread_state
# Get the annotations, if defined.
annotations = thread_state.annotations
```
This is very important to facilitate the implementation of distributed tracing and log correlation using single request ids, provided via annotations.
Contributor guide
Assessment
This issue has not been assessed yet.