[RUM] The Logs page is 2% of views but 31% of >500ms main-thread frames — a non-virtualized, index-keyed table re-renders every row per live flush

オープン
#2,083 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript

調査の方向性

Start with src/features/instance/log/LogsDataTable.tsx, then read src/features/instance/log/hooks/mergeReadLogs.ts and src/features/instance/log/hooks/useInstanceLogs.ts to trace row identity and update frequency. Check the table's row keys and rendering behavior with live log updates, then investigate TanStack virtualization. Done means the table keeps updates responsive at the stated log limits and production RUM blocking time improves after release.

索引モデルが issue の本文から書いたものです。

説明

rum

Summary

The instance Logs page (/<org>/<cluster>/logs and …/instance/<id>/logs) is Studio's worst main-thread hotspot in production RUM. It is about 2% of production views but produces 31% of all long-animation frames with more than 500ms of blocking time. Single frames reach 10–20s of blocking, so the tab freezes.

Datadog RUM findings (production fabric.harper.fast, last 15 days)

Long-task data only goes back ~15 days, so there is no older baseline. This is a measured hotspot, not a proven regression.

Logs views Every other view
Views 140 7,120
Frames with >500ms blocking (@long_task.blocking_duration) 122 272
Sessions with such a frame 17 of 80 Logs sessions (21%) —
  • Logs-view p95 blocking_duration: 808ms over 2026-10-26 → 11-09. 3,026ms in the 24h ending 2026-11-10, but that window had only 2 sessions.
  • Daily heavy-frame counts on Logs are bursty: 2 / 5 / 3 / 0 / 0 / 0 / 0 / 42 / 0 / 33 / 3 / 0 / 0 / 34 (10-26 → 11-10). Each burst comes from a long-open Logs tab.
  • Attribution of frames where scripts[] names exactly one host, as in #1684:
    • Studio's own bundle: 35 frames, 14 sessions, 78.8s total blocking. Mostly vendor-tanstack-*.js (@tanstack/query-core notifyManager in the dev file names) and vendor-react-*.js. On every other view, Studio's own bundle never produces more than 3 such frames per view.
    • www.redditstatic.com/ads/pixel.js (loaded by GTM): 52 frames, 4 sessions, 60.5s. In 15 days, every heavy Reddit-pixel frame landed on the Logs view and none on any other view. The pixel is not slow in general. Something about this page makes it slow.
    • Multi-host frames of 10–20s that mix fbevents.js, gtm.js, vendor-datadog, vendor-react and vendor-tanstack.

Likely cause (hypothesis, not yet verified in a browser)

LogsDataTable renders every entry (default limit 1,000, live retention up to max(2000, limit) in useInstanceLogs) into a table that is not virtualized. useTable gets no getRowId, so row ids, and therefore React keys, are array indexes.

mergeReadLogs returns the list newest-first. Each new line is prepended, which shifts every index. React then rewrites the text of every cell in every row, not just the new one. The SSE tail does this up to every 250ms (FLUSH_INTERVAL_MS), and the polling fallback every 5s.

That explains both signals:

  • Studio's own cost: reconciling and committing about 1–2k rows × N cells per flush.
  • The third-party cost: whole-table DOM churn feeds every MutationObserver/DOM-scanning tag that GTM injects (Reddit pixel, Facebook). That would explain why the Reddit pixel only blocks here.

Suggested fix

  1. Pass getRowId to useTable, built from the identity mergeReadLogs already computes (logKey). A prepend then mounts only the new rows and leaves existing DOM nodes untouched.
  2. Virtualize the table body, e.g. @tanstack/react-virtual, which fits the TanStack Table that is already in use. This bounds DOM size whatever the limit.
  3. Re-measure Logs-view blocking_duration p95 and heavy-frame share after the fix ships. The Reddit-pixel frames should disappear as well if the hypothesis holds.

Related: #1684 (marketing tags on /sign-in), #1762 (Reo double-load).

Reproduce the numbers
pup rum aggregate --query "@application.id:<studio> @type:long_task @view.url_host:fabric.harper.fast @view.url_hash:*logs @long_task.blocking_duration:>500000000" --compute count --from 15d --to now
pup rum events   --query "… same, without the view filter" --from 30d --to now --limit 5000   # then group by single-host scripts[].source_url

🤖 Generated by Claude Code (Claude Opus 5.5); posted via @dawsontoth.

主要言語
TypeScript
スター
5
フォーク
4
平均マージ
2日 13時間
マージ済み PR(30日)
60

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

HarperFast/studio のほかの issue

HarperFast/studio の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。