Skip to content

fix(webapp): timestamp live metric responses - #4719

Open
carderne wants to merge 1 commit into
fix/react-compiler-purity-loader-timefrom
fix/react-compiler-purity-metric-time
Open

fix(webapp): timestamp live metric responses#4719
carderne wants to merge 1 commit into
fix/react-compiler-purity-loader-timefrom
fix/react-compiler-purity-metric-time

Conversation

@carderne

@carderne carderne commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Records when live metric responses arrive and uses that timestamp to evaluate gauge freshness and waiting duration. Cached or failed responses remain untrusted until revalidated, while rendered values stay stable between polling updates.

@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d1fc356

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b1d8b7e8-b507-4394-b9fc-40855946c24b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +442 to +445
responseReceivedAt !== null &&
lastLiveBlockRow &&
Number.isFinite(lastLiveBucketMs) &&
Date.now() - lastLiveBucketMs < LIVE_GAUGE_FRESH_MS
responseReceivedAt - lastLiveBucketMs < LIVE_GAUGE_FRESH_MS

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.

🔍 Freshness now anchors to the last successful response, so a hung/paused poll can keep a stale gauge marked fresh

The three call sites now compare the newest ClickHouse bucket against the timestamp of the last successful response rather than wall-clock Date.now(). That correctly stops cache-painted rows (responseCache in apps/webapp/app/hooks/useMetricResourceQuery.ts:33) from being trusted, but it also means the freshness window no longer advances with real time: if polling stalls (a request that never resolves, or the tab hidden for a long time with pauseWhenHidden in apps/webapp/app/hooks/useMetricResourceQuery.ts:186-192), the pair (rows, responseReceivedAt) stays frozen and keeps satisfying responseReceivedAt - bucketMs < LIVE_GAUGE_FRESH_MS, so an arbitrarily old count is still shown as live until the next response lands. Previously Date.now() made it age out. A failed poll does reset to null (falling back to loader values), so this only affects the never-resolving / paused cases, and the visible window on refocus is short — hence not reported as a bug, but worth confirming it's the intended trade-off.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant