Skip to content

Persist the performance heat-map overlay and restore stats after refresh #5775

Closed

Description

@PG1204

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.
  • WorkspaceComponent clears live websocket-derived state on entry via resetWorkflowSessionState(), 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 existing localSetObject / localGetObject helpers in frontend/src/app/common/util/storage.ts, under a single key.
  • On init, read it back, set the selector, and push the view into the JointGraphWrapper stream. 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 eId and cuId, fetch its runtime statistics, reduce to the latest snapshot per operator, map WorkflowRuntimeStatistics -> OperatorStatistics, and feed it into WorkflowStatusService.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.service spec (mocked WorkflowExecutionsService): 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

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Activity

  1. added theissue type on Jun 18, 2026
  2. PG1204 commented on Jun 18, 2026

    @PG1204
    ContributorAuthor

    /take

  3. added a commit that references this issue on Sep 21, 2026
    51d7564
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions