mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Measure plugin recommendation latency during initial context setup (#62326)
Record how long initial context assembly waits for prompt-only plugin recommendations in `codex.initial_context.plugin_recommendations_wait_ms`. Use named info-level spans for loading recommendations, reading the tooling change marker, and fetching the recommendation catalog. GitOrigin-RevId: 67b26f79252f8cba6e770f43df252ec1d73a569f
This commit is contained in:
@@ -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>,
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user