Repository navigation
Description
Task Summary
Make the performance heat-map survive a page refresh: remember the overlay toggle and selected view, and restore the last execution's per-operator statistics on load so the heat-map renders without re-running the workflow.
Context
After the overlay lands (#5774), it is session-only. Reloading the workspace loses both the layer state and the statistics:
- The Layers toggles (Grid / Regions / Workers, and the new Performance layer) do not persist; they reset to off on refresh.
WorkspaceComponentclears live websocket-derived state on entry viaresetWorkflowSessionState(), so a finished run's per-operator statistics are gone after reload and the heat-map has nothing to color.
The data needed to restore a finished run already exists server-side. The backend persists runtime statistics per execution, and WorkflowExecutionsService.retrieveWorkflowRuntimeStatistics(wid, eId, cuid) already returns them (with the full timing fields) from /executions/{wid}/stats/{eId}. No backend change is required as this sub-task composes existing client APIs and feeds the result back through WorkflowStatusService (using the setExternalStatus ingestion point added in #5773).
Before: refresh -> session state cleared -> heat-map empty until re-run
After: refresh -> toggle/view restored -> last run's stats re-fetched -> fed into WorkflowStatusService -> heat-map renders
Proposed Change
In frontend/src/app/workspace/component/menu/menu.component.ts:
- Persist the overlay state (
{ view: HeatmapView | null }) to localStorage via the existinglocalSetObject/localGetObjecthelpers infrontend/src/app/common/util/storage.ts, under a single key. - On init, read it back, set the selector, and push the view into the
JointGraphWrapperstream. Scope persistence to the Performance layer only; Grid / Regions / Workers stay non-persistent as today.
New frontend/src/app/workspace/service/heatmap/heatmap-stats-restore.service.ts:
- Resolve the workflow id, fetch executions, pick the latest (prefer the most recent completed run), capture its
eIdandcuId, fetch its runtime statistics, reduce to the latest snapshot per operator, mapWorkflowRuntimeStatistics->OperatorStatistics, and feed it intoWorkflowStatusService.setExternalStatus(...).
In frontend/src/app/workspace/component/workspace.component.ts:
- After the workflow loads and session state is reset, invoke the restore service, gated on the overlay being persisted-on so non-users incur no extra fetch. Skip if a live execution is already in progress, so the live stream wins.
Required Test
- Mapper spec: full-row mapping, status code ->
OperatorState, latest-per-operator reduction, unicode operator id, and empty input → empty result. heatmap-stats-restore.servicespec (mockedWorkflowExecutionsService): no executions -> no ingestion and no throw, multiple executions -> latest picked, in-progress-only run still loads, and an HTTP error is swallowed.- Menu spec: a persisted view restores the overlay on init; an absent or null state leaves the overlay off and triggers no restore fetch.
Related
- Umbrella issue Workflow runtime performance visualization (heat-map overlay) #5772
- Depends on Capture per-operator performance metrics in WorkflowStatusService #5773, Add a toggleable performance heat-map overlay layer to the workflow canvas #5774
- RFC discussion RFC: Workflow Performance Profiler - full design & implementation walkthrough #5216
Task Type
- Refactor / Cleanup
- DevOps / Deployment / CI
- Testing / QA
- Documentation
- Performance
- Other
Activity
PG1204 commentedon Jun 18, 2026
/take
feat(frontend): restore the heat-map after a page refresh (apache#8552)