mirror of
https://github.com/openai/codex.git
synced 2026-11-05 20:10:33 +00:00
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
This commit is contained in:
@@ -40,6 +40,7 @@ use crate::request_processors::ThreadGoalRequestProcessor;
|
||||
use crate::request_processors::ThreadRequestProcessor;
|
||||
use crate::request_processors::TurnRequestProcessor;
|
||||
use crate::request_processors::WindowsSandboxRequestProcessor;
|
||||
use crate::request_processors::read_server_diagnostics;
|
||||
use crate::request_serialization::QueuedInitializedRequest;
|
||||
use crate::request_serialization::RequestSerializationQueueKey;
|
||||
use crate::request_serialization::RequestSerializationQueues;
|
||||
@@ -900,6 +901,7 @@ impl MessageProcessor {
|
||||
ClientRequest::Initialize { .. } => {
|
||||
panic!("Initialize should be handled before initialized request dispatch");
|
||||
}
|
||||
ClientRequest::ServerDiagnostics { .. } => Ok(Some(read_server_diagnostics().into())),
|
||||
ClientRequest::ConfigRead { params, .. } => self
|
||||
.config_processor
|
||||
.read(params)
|
||||
|
||||
@@ -526,6 +526,7 @@ mod bedrock_auth;
|
||||
mod catalog_processor;
|
||||
mod command_exec_processor;
|
||||
mod config_processor;
|
||||
mod diagnostics;
|
||||
mod environment_processor;
|
||||
mod feedback_doctor_report;
|
||||
mod feedback_processor;
|
||||
@@ -551,6 +552,7 @@ pub(crate) use apps_processor::AppsRequestProcessor;
|
||||
pub(crate) use catalog_processor::CatalogRequestProcessor;
|
||||
pub(crate) use command_exec_processor::CommandExecRequestProcessor;
|
||||
pub(crate) use config_processor::ConfigRequestProcessor;
|
||||
pub(crate) use diagnostics::read_server_diagnostics;
|
||||
pub(crate) use environment_processor::EnvironmentRequestProcessor;
|
||||
pub(crate) use feedback_processor::FeedbackRequestProcessor;
|
||||
pub(crate) use fs_processor::FsRequestProcessor;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
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(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user