Track executor MCP discovery telemetry (#41205)

## What changed

- Count remote executor MCP discovery attempts, including refreshes, with `success` and `error` outcomes.
- Count each discovered server by name and report whether it was found or unavailable before policy and startup filtering.

GitOrigin-RevId: b912aa64b606e6243cce79df0fe85d485a2c3547
This commit is contained in:
florence-oai authored and copyberry committed 2026-08-27 20:55:12 +00:00
1 parent d4d2b293b4
commit e931d07b88
1 file changed
+25 -3
+25 -3
View File
@@ -162,10 +162,22 @@ impl Session {
} }
let environment_id = &selected.selection.environment_id; let environment_id = &selected.selection.environment_id;
let servers = match environment let discovery = environment
.discover_http_mcp_servers(selected.cwd().clone()) .discover_http_mcp_servers(selected.cwd().clone())
.await .await;
{ let outcome = if discovery.is_ok() {
"success"
} else {
"error"
};
// Count completed discovery attempts, including refreshes, before host policy
// or MCP startup determines whether the server's tools become available.
self.services.session_telemetry.counter(
"codex.mcp.executor_discovery",
/*inc*/ 1,
&[("outcome", outcome)],
);
let servers = match discovery {
Ok(servers) => servers, Ok(servers) => servers,
Err(error) => { Err(error) => {
tracing::warn!( tracing::warn!(
@@ -177,6 +189,16 @@ impl Session {
} }
}; };
for (name, mut server) in servers { for (name, mut server) in servers {
let outcome = if server.enabled {
"found"
} else {
"unavailable"
};
self.services.session_telemetry.counter(
"codex.mcp.executor_discovery.server",
/*inc*/ 1,
&[("server_name", name.as_str()), ("outcome", outcome)],
);
if name == CODEX_APPS_MCP_SERVER_NAME if name == CODEX_APPS_MCP_SERVER_NAME
|| !server.is_local_environment() || !server.is_local_environment()
|| projection || projection