Commit 7f7bcc8
authored
fix(ray): increase ray instrumentation stability (#15446)
Ray integration was until very soon only tested internally. We had
several issues with instrumenting jobs based on when ray was initialized
and some crashes related to context injection.
This PR is created to fix all the small issues and make the integration
stable. Ray integration should be advertised to be used only on versions
including this fix. The releasenote is covering the only customer facing
issue.
## Context
During internal dogfooding some bugs were found/some assumptions were
challenged:
- Most of the users can't called `ray.init()` at the top of the file
(which was a prerequisite for a fully working instrumentation).
After analyzing all the consequences of calling ray.init() late or
waiting for auto-initialization (for example when a task is submitted
for the first time), it appears that the only viable solution was to
change the way we instrument the cluster.
- Some ray internal tasks were instrumented and created non
actionnable/useful orphan spans.
- We still had issues with context injection
- Service names were not properly working when unspecified.
## Changes
- Update docs to recommend using ddtrace-run. Note that we advise to
deactivate some integrations otherwise instrumenting ray cluster is very
noisy. We will be able to remove that if we make an upstream
contribution.
- Fix service names and specify precedence order in docs.
- Prevent some potential future bugs by not instrumenting cross_language
tasks
- Add a fix for injecting `dd_trace_ctx` in tasks.
## Testing
I added some tests to ensure all the behavior are tested:
- Added some tests related to service name
- Added some tests to show the issues with not calling ray.init() to be
sure it is documented and any changes will be detected. This tests are
also ensuring that nothing crashes.
## Additional Notes
Ray test suite were run while ddtrace activated increasing the
confidence in this PR.1 parent fe695a8 commit 7f7bcc8
File tree
20 files changed
+1777
-354
lines changed- ddtrace/contrib/internal/ray
- releasenotes/notes
- tests
- contrib/ray
- jobs
- snapshots
20 files changed
+1777
-354
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | | - | |
| 17 | + | |
19 | 18 | | |
20 | | - | |
| 19 | + | |
21 | 20 | | |
22 | | - | |
| 21 | + | |
23 | 22 | | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
48 | 49 | | |
49 | | - | |
| 50 | + | |
50 | 51 | | |
51 | | - | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| |||
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
146 | 157 | | |
147 | 158 | | |
148 | 159 | | |
| |||
153 | 164 | | |
154 | 165 | | |
155 | 166 | | |
156 | | - | |
| 167 | + | |
157 | 168 | | |
158 | 169 | | |
159 | 170 | | |
160 | | - | |
161 | 171 | | |
162 | 172 | | |
163 | 173 | | |
| |||
197 | 207 | | |
198 | 208 | | |
199 | 209 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
204 | 215 | | |
205 | 216 | | |
| 217 | + | |
206 | 218 | | |
207 | | - | |
| 219 | + | |
208 | 220 | | |
209 | | - | |
210 | 221 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
216 | 228 | | |
217 | 229 | | |
218 | 230 | | |
| |||
380 | 392 | | |
381 | 393 | | |
382 | 394 | | |
383 | | - | |
| 395 | + | |
384 | 396 | | |
385 | 397 | | |
386 | 398 | | |
387 | 399 | | |
388 | | - | |
| 400 | + | |
389 | 401 | | |
390 | 402 | | |
391 | 403 | | |
| |||
497 | 509 | | |
498 | 510 | | |
499 | 511 | | |
500 | | - | |
| 512 | + | |
501 | 513 | | |
502 | 514 | | |
503 | 515 | | |
| |||
557 | 569 | | |
558 | 570 | | |
559 | 571 | | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
560 | 576 | | |
561 | 577 | | |
562 | 578 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
This file was deleted.
This file was deleted.
| 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 | + | |
This file was deleted.
This file was deleted.
| 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 | + | |
0 commit comments