mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +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
@@ -54,6 +54,8 @@ use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use codex_config::McpServerTransportConfig;
|
||||
use codex_diagnostics::Gauge;
|
||||
use codex_diagnostics::GaugeGuard;
|
||||
use codex_protocol::mcp::CallToolResult;
|
||||
use codex_protocol::mcp::McpServerInfo;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
@@ -71,10 +73,13 @@ use tokio::sync::watch;
|
||||
use tokio::task::JoinSet;
|
||||
use tracing::warn;
|
||||
|
||||
static LIVE_CONNECTIONS: Gauge = Gauge::new("mcp.connections.live");
|
||||
|
||||
pub(crate) struct McpServerConnection {
|
||||
identity: Option<McpServerConnectionIdentity>,
|
||||
client: AsyncManagedClient,
|
||||
startup_trigger: Option<watch::Sender<bool>>,
|
||||
_diagnostics_guard: GaugeGuard,
|
||||
}
|
||||
|
||||
impl McpServerConnection {
|
||||
@@ -440,6 +445,7 @@ impl McpConnectionSet {
|
||||
identity: Some(connection_identity),
|
||||
client: async_managed_client.clone(),
|
||||
startup_trigger,
|
||||
_diagnostics_guard: LIVE_CONNECTIONS.track(),
|
||||
}),
|
||||
metadata,
|
||||
tool_filter: configured_tool_filter,
|
||||
|
||||
Reference in new issue
Block a user