Commit b626393
authored
chore(ray): add instrumentation for ray.get (#14768)
## Description
This PR adds instrumentation for ray.get to our Ray integration, as
specified in
[MLOB-3820](https://datadoghq.atlassian.net/browse/MLOB-3820). This is
based on #14587, and is a
clean recreation of #14658
with some minor changes.
## Testing
**NOTE (10/3 12PM): All tests re-run after latest commit**
I launched the testagent with docker compose up -d testagent, and then
in a scripts/ddtest container I ran `DD_AGENT_PORT=9126 riot -v run
--pass-env -p 3.12 ray -- -s -vv` to execute the snapshot tests, which
resulted in all tests passing. I committed and pushed the generated
snapshot tests jsons to this branch.
<img width="1131" height="171" alt="Screenshot 2025-10-03 at 11 28
59 AM"
src="https://github.com/user-attachments/assets/791f328e-9adf-463b-8a79-b822426c0ca6"
/>
Manual test on local Ray cluster:
Create/activate ray venv and pip install dd-trace-py from local repo
with these changes.
```
export DD_SERVICE="imran-ray-get-test-002"
export DD_TRACE_RAY_CORE_API=1
RAY_LOGGING_CONFIG_ENCODING=JSON DD_ENV=dev ray start --head --dashboard-host=127.0.0.1 --tracing-startup-hook=ddtrace.contrib.ray:setup_tracing
```
submit the
[simple_get.py](https://github.com/user-attachments/files/22682834/simple_get.py)
test job to local cluster with:
`ray job submit --submission-id="imran-ray-get-test-002" -- python
/Users/imran.hendley/scripts/simple_get.py`
And we can see the ray.get span on the job:
<img width="1217" height="933" alt="Screenshot 2025-10-03 at 11 49
28 AM"
src="https://github.com/user-attachments/assets/6feb4530-d1f1-43bb-83aa-99d3d424c315"
/>
The same span in trace explorer is
[here](https://dd.datad0g.com/apm/trace/68dff038000000001c792f1f5460456c?graphType=json&shouldShowLegend=true&spanID=18012011505180865563&timeHint=1759506488231.9692&traceQuery=).
## Risks
None
## Additional Notes
None
[MLOB-3820]:
https://datadoghq.atlassian.net/browse/MLOB-3820?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ1 parent 6ad4124 commit b626393
File tree
5 files changed
+149
-1
lines changed- ddtrace/contrib/internal/ray
- tests
- contrib/ray
- snapshots
5 files changed
+149
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
287 | 288 | | |
288 | 289 | | |
289 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
290 | 318 | | |
291 | 319 | | |
292 | 320 | | |
| |||
529 | 557 | | |
530 | 558 | | |
531 | 559 | | |
| 560 | + | |
532 | 561 | | |
533 | 562 | | |
534 | 563 | | |
| |||
545 | 574 | | |
546 | 575 | | |
547 | 576 | | |
| 577 | + | |
548 | 578 | | |
549 | 579 | | |
550 | 580 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
218 | 229 | | |
219 | 230 | | |
220 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
Lines changed: 103 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
0 commit comments