feat: metrics on shell snapshot (#9527)

This commit is contained in:
jif-oai 2026-01-20 13:18:24 +00:00 committed by GitHub
parent 6bbf506120
commit 3a9f436ce0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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());