Commit 18a0424
authored
[procmgrd] Add write RPCs: Create, Start, Stop, ReloadConfig (#47527)
### What does this PR do?
Adds four write RPCs to the dd-procmgrd gRPC service: **Create**, **Start**, **Stop**, and **ReloadConfig**.
Write operations are funneled through a `Command` channel from the gRPC service to the main event loop, which is the single owner of process lifecycle mutations. Read RPCs (List, Describe, GetStatus) continue to read directly via the shared `RwLock`.
- **Create** — registers a new process from an inline config (name + command required, all other fields optional with sensible defaults). Uses `optional bool auto_start` in proto3 to distinguish "not set" from "set to false".
- **Start** — spawns any non-running process (Created, Stopped, Failed, Exited) and wires the exit watcher.
- **Stop** — sends SIGTERM to a running process. A `stop_requested` flag ensures the process transitions to `Stopped` (not `Failed`) and skips restart logic.
- **ReloadConfig** — re-reads YAML configs from disk, adds new processes, and removes processes whose configs were deleted (stopping them gracefully first).
### Motivation
The previous PR #47388 added a read-only gRPC server. This PR completes the control plane by enabling clients to manage process lifecycle through the gRPC API — creating ad-hoc processes, starting/stopping them, and hot-reloading configs without restarting the daemon.
### Describe how you validated your changes
- `cargo fmt -- --check` — clean
- `cargo clippy --bin dd-procmgrd -- -D warnings` — clean
- `cargo test --bin dd-procmgrd` — 103 tests pass (82 pre-existing + 21 new)
- New test coverage:
- Start: success, not found, already running
- Stop: success, not found, not running, start-then-stop round trip
- Create: create-then-start, duplicate name, empty command, defaults applied, custom overrides
- `stop_requested` flag: transitions to Stopped, skips restart, doesn't affect normal exits
- Mixed-state GetStatus with running/failed/stopped/exited/created processes
### Additional Notes
Co-authored-by: josemanuel.almaza <josemanuel.almaza@datadoghq.com>1 parent 1dfe3da commit 18a0424
File tree
13 files changed
+2147
-545
lines changed- pkg/procmgr/rust
- proto
- src
- grpc
- tests
- releasenotes/notes
13 files changed
+2147
-545
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
67 | 72 | | |
68 | 73 | | |
69 | 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 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
70 | 114 | | |
71 | 115 | | |
72 | 116 | | |
| |||
81 | 125 | | |
82 | 126 | | |
83 | 127 | | |
84 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
85 | 137 | | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 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 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
15 | 140 | | |
16 | 141 | | |
17 | 142 | | |
| |||
47 | 172 | | |
48 | 173 | | |
49 | 174 | | |
50 | | - | |
| 175 | + | |
51 | 176 | | |
52 | 177 | | |
53 | 178 | | |
| |||
59 | 184 | | |
60 | 185 | | |
61 | 186 | | |
| 187 | + | |
62 | 188 | | |
63 | 189 | | |
64 | 190 | | |
| |||
158 | 284 | | |
159 | 285 | | |
160 | 286 | | |
161 | | - | |
| 287 | + | |
162 | 288 | | |
163 | 289 | | |
164 | 290 | | |
| |||
194 | 320 | | |
195 | 321 | | |
196 | 322 | | |
197 | | - | |
| 323 | + | |
198 | 324 | | |
199 | 325 | | |
200 | 326 | | |
| |||
238 | 364 | | |
239 | 365 | | |
240 | 366 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
250 | 379 | | |
251 | 380 | | |
252 | 381 | | |
| |||
258 | 387 | | |
259 | 388 | | |
260 | 389 | | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
270 | 399 | | |
271 | 400 | | |
272 | 401 | | |
| |||
277 | 406 | | |
278 | 407 | | |
279 | 408 | | |
280 | | - | |
| 409 | + | |
281 | 410 | | |
282 | 411 | | |
283 | 412 | | |
| |||
288 | 417 | | |
289 | 418 | | |
290 | 419 | | |
291 | | - | |
| 420 | + | |
292 | 421 | | |
293 | 422 | | |
294 | 423 | | |
| |||
315 | 444 | | |
316 | 445 | | |
317 | 446 | | |
318 | | - | |
| 447 | + | |
319 | 448 | | |
320 | 449 | | |
321 | 450 | | |
| |||
327 | 456 | | |
328 | 457 | | |
329 | 458 | | |
330 | | - | |
| 459 | + | |
331 | 460 | | |
332 | 461 | | |
333 | 462 | | |
| |||
381 | 510 | | |
382 | 511 | | |
383 | 512 | | |
384 | | - | |
385 | | - | |
| 513 | + | |
| 514 | + | |
386 | 515 | | |
387 | | - | |
| 516 | + | |
388 | 517 | | |
389 | 518 | | |
390 | | - | |
391 | | - | |
| 519 | + | |
| 520 | + | |
392 | 521 | | |
393 | | - | |
| 522 | + | |
394 | 523 | | |
395 | 524 | | |
396 | 525 | | |
| |||
0 commit comments