Add process diagnostics snapshots (#37434)

## What changed

- Add a `codex-diagnostics` crate that snapshots the process ID, available
  resident-memory measurements, and registered process-wide gauges.
- Provide guards that update gauges for the lifetime of measured objects.
- Track live `CodexThread` instances with the `core.threads.live` gauge.

## Testing

- Add unit coverage for gauge registration, guard lifetimes, process memory
  snapshots, and live-thread reporting.

GitOrigin-RevId: 3236b086bd4ebe31ed4768ab87a5fa288b0891b0
This commit is contained in:
jif
2026-08-07 11:21:54 +00:00
committed by copyberry
parent 51e36d2ec2
commit a7dcd20d38
9 changed files with 317 additions and 0 deletions

9
codex-rs/Cargo.lock generated
View File

@@ -2726,6 +2726,7 @@ dependencies = [
"codex-context-fragments",
"codex-core-plugins",
"codex-core-skills",
"codex-diagnostics",
"codex-exec-server",
"codex-exec-server-test-support",
"codex-execpolicy",
@@ -2937,6 +2938,14 @@ dependencies = [
"zip",
]
[[package]]
name = "codex-diagnostics"
version = "0.0.0"
dependencies = [
"libc",
"pretty_assertions",
]
[[package]]
name = "codex-exec"
version = "0.0.0"