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

Increment view_count on card, dashboard, and table views #41882

Merged
merged 12 commits into from May 8, 2024

Conversation

calherries
Copy link
Contributor

@calherries calherries commented Apr 26, 2024

Epic: #38229
Technical doc

Previously: #41840

With this PR, we

  1. add a new column metabase_table.view_count and increment it on a table view, following the same criteria for a view as we do for adding new entries to view_log.
  2. increment report_card.view_count, report_dashboard.view_count, and metabase_table.view_count if cards, dashboards, and tables are viewed respectively. Before this the column was not being updated at all.

I've deliberately coupled the code that currently updates view_log with the new code that updates the view_count column because we decided to keep these two in sync to avoid confusing discrepancies between them, and lower the risk them getting out of sync in the future.

That means we count:

  • public and embedded card/dashboard views, as well as regular views
  • if a dashboard is viewed we increment both the dashboard and all the cards in the dashboard
  • if a card is pinned to a collection and the collection is viewed, we count a view for the card

@metabase-bot metabase-bot bot added the .Team/BackendComponents also known as BEC label Apr 26, 2024
@calherries calherries requested a review from a team April 26, 2024 13:22
@calherries calherries added the backport Automatically create PR on current release branch on merge label Apr 26, 2024
@calherries calherries changed the title Increment view_count columns on card and dashboard views Increment view_count on card and dashboard views Apr 26, 2024
Copy link

replay-io bot commented Apr 26, 2024

Status Complete ↗︎
Commit db0de4f
Results
⚠️ 8 Flaky
2429 Passed

Copy link
Member

@tsmacdonald tsmacdonald left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me ⛵

@calherries calherries enabled auto-merge (squash) April 30, 2024 11:57
@calherries calherries changed the title Increment view_count on card and dashboard views Increment view_count on card, dashboard, and table views Apr 30, 2024
@calherries
Copy link
Contributor Author

calherries commented Apr 30, 2024

(I accidentally merged the downstream branch into this one, so I'll wait for CI and merge this PR in to save on admin effort)

@calherries calherries merged commit 07a22a8 into master May 8, 2024
110 checks passed
@calherries calherries deleted the update-view-count-columns branch May 8, 2024 09:56
Copy link

github-actions bot commented May 8, 2024

@calherries Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Automatically create PR on current release branch on merge no-backport Do not backport this PR to any branch .Team/BackendComponents also known as BEC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants