diff --git a/codex-rs/core-plugins/src/remote.rs b/codex-rs/core-plugins/src/remote.rs index 4359ed945d..78b64c3634 100644 --- a/codex-rs/core-plugins/src/remote.rs +++ b/codex-rs/core-plugins/src/remote.rs @@ -1160,7 +1160,11 @@ pub fn invalidate_cached_remote_plugin_catalog_scopes( } } -#[instrument(level = "trace", skip_all)] +#[instrument( + name = "plugins.recommendations.read_tooling_marker", + level = "info", + skip_all +)] pub(crate) async fn fetch_tooling_changed_at( config: &RemotePluginServiceConfig, auth: Option<&CodexAuth>, @@ -1181,7 +1185,11 @@ pub(crate) async fn fetch_tooling_changed_at( }) } -#[instrument(level = "trace", skip_all)] +#[instrument( + name = "plugins.recommendations.fetch_catalog", + level = "info", + skip_all +)] pub async fn fetch_recommended_plugins( config: &RemotePluginServiceConfig, auth: Option<&CodexAuth>, diff --git a/codex-rs/core/src/session/mod.rs b/codex-rs/core/src/session/mod.rs index b6318819f2..482505b42f 100644 --- a/codex-rs/core/src/session/mod.rs +++ b/codex-rs/core/src/session/mod.rs @@ -5284,7 +5284,14 @@ impl Session { .features .plugin_recommendations_enabled() { - match PreparedToolRecommendations::load(self, turn_context).await { + let started_at = std::time::Instant::now(); + let recommendations = PreparedToolRecommendations::load(self, turn_context).await; + turn_context.session_telemetry.record_duration( + "codex.initial_context.plugin_recommendations_wait_ms", + started_at.elapsed(), + &[], + ); + match recommendations { PreparedToolRecommendations::Endpoint(tools) => Some(tools), PreparedToolRecommendations::Legacy(_) => None, } diff --git a/codex-rs/core/src/session/turn.rs b/codex-rs/core/src/session/turn.rs index 32fc11c5c8..5e2a229286 100644 --- a/codex-rs/core/src/session/turn.rs +++ b/codex-rs/core/src/session/turn.rs @@ -2228,7 +2228,7 @@ pub(super) enum PreparedToolRecommendations { } impl PreparedToolRecommendations { - #[instrument(level = "trace", skip_all)] + #[instrument(name = "plugins.recommendations.load", level = "info", skip_all)] pub(super) async fn load(sess: &Session, turn_context: &TurnContext) -> Self { let auth = sess.services.auth_manager.auth().await; let endpoint_candidates = sess