Files
jif 5729546839 Expose app-server diagnostics through the experimental API (#37470)
## What changed

- Add the experimental `server/diagnostics` request, returning the app-server process ID, resident memory, platform-dependent physical footprint, and registered diagnostic gauges.
- Export the new protocol types in the generated JSON and TypeScript schemas and document the request.

## Testing

- Verify the response includes process measurements and the registered live-thread gauge.
- Verify the request is rejected unless `capabilities.experimentalApi` is enabled.

GitOrigin-RevId: 099d60a9c421a74ff1a72fe524e0dfeb89cf1057
2026-08-07 16:57:47 +00:00

24 lines
837 B
Rust

use codex_app_server_protocol::ServerDiagnosticsGauge;
use codex_app_server_protocol::ServerDiagnosticsProcess;
use codex_app_server_protocol::ServerDiagnosticsResponse;
pub(crate) fn read_server_diagnostics() -> ServerDiagnosticsResponse {
let diagnostics = codex_diagnostics::snapshot();
ServerDiagnosticsResponse {
process: ServerDiagnosticsProcess {
id: diagnostics.process.id,
resident_memory_bytes: diagnostics.process.resident_memory_bytes,
physical_footprint_bytes: diagnostics.process.physical_footprint_bytes,
},
gauges: diagnostics
.gauges
.into_iter()
.map(|gauge| ServerDiagnosticsGauge {
name: gauge.name.to_string(),
value: gauge.value,
})
.collect(),
}
}