Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll depth: update site.scroll_depth_visible_at in ingestion #5035

Merged
merged 8 commits into from
Feb 3, 2025

Conversation

macobo
Copy link
Contributor

@macobo macobo commented Jan 30, 2025

We decide what metrics to show dynamically based on whether site has sent us scroll depth data.

Previously, this data was queried dynamically from ClickHouse on page loads, but this approach adds 50-200ms to every page load until a site has sent us scroll depth data.

Instead, we now update site.scroll_depth_visible_at in ingestion. To limit impact on ingestion:

  1. scroll_depth_visible_at is now cached along with other ingestion site data.
  2. updates are processed using ets, making sure only one database update is ever done per site
  3. handles errors gracefully if postgres is ever in e.g. read-only mode or otherwise unavailable.

I'm curious whether I'm taking a sane approach with the GenServer here. cc @zoldar for feedback on that front.

@macobo macobo requested a review from RobertJoonas January 30, 2025 13:29
@macobo macobo force-pushed the genserver-update-scroll-depth-visibility branch from 9bce221 to 37eae52 Compare January 30, 2025 13:31
Copy link
Contributor

@zoldar zoldar left a comment

Choose a reason for hiding this comment

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

use Plausible.DataCase
use Plausible.Teams.Test

test "mark_scroll_depth_visible" do
Copy link
Contributor

Choose a reason for hiding this comment

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

This test can never fail. We should assert on the return value of TestUtils.eventually

@macobo macobo added this pull request to the merge queue Feb 3, 2025
Merged via the queue into master with commit 84aea97 Feb 3, 2025
8 checks passed
cnkk added a commit that referenced this pull request Feb 3, 2025
zoldar added a commit that referenced this pull request Feb 3, 2025
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2025
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.

3 participants