Skip to content

feat(web): align timeline cursor with revision changedTime and display secondary log cursor - #1200

Merged
kyasbal merged 5 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-okqtmylnrwtm
Oct 30, 2026
Merged

kyasbal merged 5 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-okqtmylnrwtm

Conversation

@kyasbal

@kyasbal kyasbal commented Oct 30, 2026

Copy link
Copy Markdown
Member

Background

In KHI, a resource Revision has two potentially distinct timestamps:

  • revision.changedTime: when the resource state transition actually occurred (for example, status.containerStatuses[].state.running.startedAt or metadata.deletionTimestamp).
  • log.timestamp: when the underlying log entry reporting that state transition was recorded (for example, an asynchronously synced Node / Pod PATCH audit log or a log used to infer an initial state at changedTime = 0).

Previously, selecting or hovering over a revision on the timeline chart placed the vertical timeline cursor and anchored the hover popup search window at log.timestamp instead of revision.changedTime, even though revision bars on the timeline canvas are drawn starting at revision.changedTime. When log.timestamp lagged behind revision.changedTime by several seconds (or when an initial-state revision at changedTime = 0 was inferred from a later log), clicking or hovering a revision bar caused the cursor and hover popup to jump away from the revision's visual boundary, making the cursor appear misaligned. Additionally, when a single log entry produced multiple revisions on the same timeline (such as container termination and restart reported in one Pod status update), selection and hover state in the hover overlay and Diff list could not distinguish between those revisions because they matched only by logIndex.

Approach

  1. Align Primary Cursor and Hover Target with revision.changedTime:

    • Anchor the primary timeline cursor to selectedRevision.legacyChangedTimeMs (clamped to minQueryLogTimeMS for initial-state or pre-query revisions) when a revision is selected, while keeping selectedLog.legacyTimestampMs for event and log selections.
    • Anchor hover time and cross-pane log highlight resolution on the timeline to revision.changedTime when targeting a revision, clamping the hover target to the visible portion of the revision bar when its start is scrolled off-screen to the left.
    • Suppress forced horizontal auto-scrolling to the far left when selecting a revision whose changedTime precedes minQueryLogTimeMS.
  2. Display a Secondary Log Timestamp Cursor:

    • When a selected revision's changedTime differs from its underlying log.timestamp, render a secondary dashed vertical cursor line and a second-tier header label (Log: <ISO timestamp> (+4.4s)) at log.timestamp so both the state transition time and the log recording time remain visible simultaneously.
  3. Disambiguate Multi-Revision Logs Across Selection, Hover Overlay, and Diff List:

    • Track highlightedRevision in SelectionManager and preserve selectedRevision when onSelectLog is invoked for a log that corresponds to multiple revisions on the active timeline.
    • Disambiguate Selected and Hovered states in TimelineHoverOverlayComponent and DiffListComponent by revision identity (revision.id / revision.index) rather than logIndex alone, and add a tooltip on Diff list timestamps explaining the delta when changedTime and log.timestamp diverge.
@kyasbal kyasbal added type:feature New feature or request area:frontend Web frontend application and UI components labels Oct 30, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for a secondary cursor on the timeline to represent the log timestamp when it differs from the selected revision's changed time, along with tooltip updates to show time deltas. It also updates the selection manager to track and highlight specific revisions rather than just logs, helping to disambiguate revisions sharing the same log index. Feedback on these changes suggests disabling empty tooltips in the diff list, removing a redundant defensive check for onHighlightRevision, simplifying a redundant Math.max clamping logic in the timeline frame, and deduplicating the minQueryTimeNs calculation in TimelineSmartComponent.

@kyasbal
kyasbal added this pull request to the merge queue Oct 30, 2026
Merged via the queue into GoogleCloudPlatform:main with commit b305dca Oct 30, 2026
17 checks passed
@kyasbal
kyasbal deleted the push-okqtmylnrwtm branch October 30, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Web frontend application and UI components type:feature New feature or request

1 participant