mirror of
https://github.com/openai/codex.git
synced 2026-11-12 21:20:34 +00:00
Add debug timing for thread item pagination (#59497)
## What changed - Log `thread/items/list` request IDs, cursor kinds, page sizes, next-page availability, elapsed time, and success status. - Log remote-control item-page response preparation and WebSocket write times, along with request and stream IDs, sequence IDs, frame counts, wire bytes, and success, interruption, or write-error outcomes. Collect these transport metrics only when debug logging is enabled. GitOrigin-RevId: 0f26bef6d6b8cacbd5a5c76c49a5f882669f6598
This commit is contained in:
@@ -1001,11 +1001,29 @@ impl ThreadRequestProcessor {
|
||||
|
||||
pub(crate) async fn thread_items_list(
|
||||
&self,
|
||||
request_id: &ConnectionRequestId,
|
||||
params: ThreadItemsListParams,
|
||||
) -> Result<Option<ClientResponsePayload>, JSONRPCErrorError> {
|
||||
self.thread_items_list_response_inner(params)
|
||||
.await
|
||||
.map(|response| Some(response.into()))
|
||||
let cursor_kind = match ¶ms.cursor {
|
||||
None => "none",
|
||||
Some(ThreadItemsListCursor::Opaque(_)) => "opaque",
|
||||
Some(ThreadItemsListCursor::Anchor(ThreadItemsListAnchor::Item { .. })) => {
|
||||
"item_anchor"
|
||||
}
|
||||
};
|
||||
let started = std::time::Instant::now();
|
||||
let result = self.thread_items_list_response_inner(params).await;
|
||||
let page = result.as_ref().ok();
|
||||
tracing::debug!(
|
||||
request_id = %request_id.request_id,
|
||||
cursor_kind,
|
||||
item_count = page.map(|page| page.data.len()),
|
||||
has_next_page = page.map(|page| page.next_cursor.is_some()),
|
||||
duration_ms = started.elapsed().as_millis() as u64,
|
||||
success = result.is_ok(),
|
||||
"thread/items/list finished"
|
||||
);
|
||||
result.map(|response| Some(response.into()))
|
||||
}
|
||||
|
||||
pub(crate) async fn thread_items_read(
|
||||
|
||||
Reference in New Issue
Block a user