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:
yiqian-oai
2026-11-04 21:33:28 +00:00
committed by copyberry
parent b260ee5e83
commit dc1cc0a0e8
4 changed files with 85 additions and 8 deletions
@@ -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 &params.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(