feat(metrics): wiki on unified metric-results - #1812
Conversation
Reproduce the wiki bullet metrics on the unified path — a gold observation view over the wiki silver classes plus registry seeds — so pages-created, edits, pages-edited and comments-received serve through /v1/metric-results like the other families. edits binds to class_wiki_activity.total_edits (session-collapsed, per actual editor, edit-dated) rather than the legacy page-snapshot version_count-1, which over-counted autosaves and credited every revision to the page's original author. pages-edited is new from the same rollup. comments stay attributed to the page author (engagement received); the engagement->pages join adds source_id to prevent cross-instance fan-out. active-authors is dropped. Attribution keys on the lowercased author email; accounts that do not resolve to one are excluded rather than carried as unmatchable ids. Closes #1700 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
class_wiki_activity reads confluence/outline wiki_page_versions, but the bronze bootstrap never created stand-ins for them, so the model failed to build on any instance without a real versions sync. Add both placeholders (IF NOT EXISTS, columns per each connector's schema) so a fresh bronze bootstraps a buildable wiki activity class. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesWiki unified metrics
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant WikiSources
participant WikiMetricObservations
participant AnalyticsRegistry
WikiSources->>WikiMetricObservations: aggregate page, activity, and engagement data
WikiMetricObservations->>AnalyticsRegistry: expose standardized wiki measures
AnalyticsRegistry->>AnalyticsRegistry: resolve four built-in wiki metrics
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/ingestion/gold/wiki_metric_observations.sql`:
- Around line 54-115: Update the pages, activity, and engagement CTE flow to
pre-aggregate records at (tenant_id, entity_id, metric_date) so each metric
emits one row per unique grain. Separate the pages base data used for engagement
joins from the daily pages aggregation, remove the created_at IS NOT NULL
exclusion from the join source, and retain engagement rows for pages lacking
timestamps. Apply the corresponding day-grain GROUP BY clauses before the
value_measures unions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e439fb2c-5a61-4e20-94b6-43ab87aa1ba2
📒 Files selected for processing (9)
src/backend/services/analytics/src/domain/metric_definitions/builtin.rssrc/ingestion/dbt/tests/gold/assert_wiki_observations_entity_id_shape.sqlsrc/ingestion/dbt/tests/gold/assert_wiki_observations_nonnegative.sqlsrc/ingestion/dbt/tests/gold/assert_wiki_observations_subject_key_shape.sqlsrc/ingestion/dbt/tests/gold/assert_wiki_observations_unique_grain.sqlsrc/ingestion/gold/schema.ymlsrc/ingestion/gold/wiki_metric_observations.sqlsrc/ingestion/scripts/create-bronze-placeholders.shsrc/ingestion/silver/wiki/schema.yml
The comment join reused the pages_created branch, whose created_at gate exists only to date the creation metric — so comments on a page snapshot lacking the timestamp were dropped. Split the join source (page -> author, email gate only) from the dated creation branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
Migrate the wiki family to
/v1/metric-results, mirroring the git/collab/task cutovers. Wiki was the last IC family on the legacy bullet path (insight.wiki_bullet_rows+ seeded query_refs).What
wiki_metric_observationsover the wiki silver classes, plus registry seeds — four metrics served on the unified path:wiki.pages_created— pages authored (fromclass_wiki_pages)wiki.edits— logical edit sessionswiki.pages_edited— distinct pages edited (new)wiki.comments— comments received on the person's pageseditsbinds toclass_wiki_activity.total_edits(autosave-collapsed, per real editor, edit-dated) instead of the legacy page-snapshotversion_count-1, which over-counted saves and credited every revision to the page's original author. Values will read lower than the legacy dashboard — intended.commentskeep page-author attribution (engagement received, per Figma: Bronze connector #285 design); the engagement->pages join addssource_idto prevent cross-instance fan-out.active_authorsdropped from the per-person set (team can derive it).Placeholder fix
Separate commit: the bronze bootstrap never created
wiki_page_versionsstand-ins for either connector, soclass_wiki_activityfailed to build on any instance without a real versions sync — the root of the historical "unstable on dev" note. Added both placeholders.Safety
Purely additive: legacy
wiki_bullet_rows+ seeds + catalog untouched (old FE keeps working). Gold ismaterialized='table'(full CTAS) so no positional/incremental drift. Placeholder script isIF NOT EXISTS, idempotent on existing instances.Verification
cargo fmt --check,clippy -D warnings,cargo test -p analytics(437 passed)dbt build +wiki_metric_observations— 132/132/v1/metric-resultsserves all four × period/peer/timeseries with exact ClickHouse parity;pages_created/commentsmatch legacy,editslower by design.Deferred: e2e retarget to
wiki.*(no unified-endpoint 200 fixture repo-wide yet), legacywiki_bullet_rowsretirement.Closes #1700
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation