[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

Abierto
#2,083 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
react, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
5
Forks
4
Merge medio
2 d 13 h
PR fusionados (30 d)
60

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de HarperFast/studio

Todos los issues de HarperFast/studio

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.