From 3a9f436ce00124cabe71f102c3a2c29f097ccc4c Mon Sep 17 00:00:00 2001 From: jif-oai Date: Tue, 20 Jan 2026 13:18:24 +0000 Subject: [PATCH] feat: metrics on shell snapshot (#9527) --- codex-rs/core/src/codex.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index a2a3481d8..c5332f26d 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -710,10 +710,18 @@ impl Session { let mut default_shell = shell::default_user_shell(); // Create the mutable state for the Session. if config.features.enabled(Feature::ShellSnapshot) { + let timer = otel_manager.start_timer("codex.shell_snapshot.duration_ms", &[]); default_shell.shell_snapshot = ShellSnapshot::try_new(&config.codex_home, conversation_id, &default_shell) .await .map(Arc::new); + let success = if default_shell.shell_snapshot.is_some() { + "true" + } else { + "false" + }; + let _ = timer.map(|timer| timer.record(&[("success", success)])); + otel_manager.counter("codex.shell_snapshot", 1, &[("success", success)]) } let state = SessionState::new(session_configuration.clone());