Spans with distinct names get merged
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 778
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 3
Description
If I do this, I get two spans:
```python
import distributed
from distributed.spans import span
client = distributed.Client()
def double(x):
return x * 2
with span("double-3"):
client.submit(double, 3)
# wait a bit
with span("double-5"):
client.submit(double, 5)
```
But if I don't wait a bit and just run this code all at once, I get a single span named `double-3`. That doesn't seem right to me.
I noticed this because I was trying to submit tasks in a loop so I could make them distinct spans, like so:
```python
futures = []
for i in range(10):
with span(f"double-{i}"):
f = client.submit(double, i)
futures.append(f)
```
But of course that fails in the same way: I get a single `double-0` span.
(I'm trying to figure out how to map a function over some data and have each of those tasks a distinct span.)
Contributor guide
Assessment
This issue has not been assessed yet.