dask / dask/distributed

Make annotations available in the thread_state

Open
#6,932 4 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.