mirror of
https://github.com/openai/codex.git
synced 2026-11-09 08:40:33 +00:00
Expose runtime activity in server diagnostics (#37486)
## What changed - Add lifecycle-backed gauges for in-flight and queued app requests, pending server requests and mailbox messages, active turns, and live MCP connections. - Register each gauge on first use and decrement it when the tracked work or resource is dropped. - Document the new `server/diagnostics` gauge names and account for the diagnostics request itself in the response example and test. GitOrigin-RevId: 4bb82a3918af0b502d149b5d761ad669b2083f39
This commit is contained in:
1 parent
5a0d0929e2
commit
27e4a05cd3
11 files changed
+64
-7
No files matched your search
@@ -8,6 +8,7 @@ use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
|
||||
use codex_diagnostics::Gauge;
|
||||
use codex_extension_api::ThreadIdleCause;
|
||||
use futures::future::BoxFuture;
|
||||
use tokio::select;
|
||||
@@ -63,6 +64,7 @@ pub(crate) use user_shell::execute_user_shell_command;
|
||||
|
||||
const GRACEFULL_INTERRUPTION_TIMEOUT_MS: u64 = 100;
|
||||
const TASK_COMPACT_METRIC: &str = "codex.task.compact";
|
||||
static ACTIVE_TURNS: Gauge = Gauge::new("core.turns.active");
|
||||
|
||||
pub(crate) type SessionTaskResult = CodexResult<Option<String>>;
|
||||
|
||||
@@ -421,6 +423,7 @@ impl Session {
|
||||
cancellation_token,
|
||||
turn_context: Arc::clone(&turn_context),
|
||||
_agent_execution_guard: agent_execution_guard,
|
||||
_diagnostics_guard: ACTIVE_TURNS.track(),
|
||||
_timer: timer,
|
||||
};
|
||||
turn.task = Some(running_task);
|
||||
|
||||
Reference in new issue
Block a user