Repository navigation
perf: read only gerrit segments for patchsets per review - #5318
Conversation
Signed-off-by: anilb <epipav@gmail.com>
|
@greptileai review |
|
|
PR SummaryMedium Risk Overview It adds The KPI and time-series nodes now source from Reviewed by Cursor Bugbot for commit 4af9af5. Bugbot is set up for automated code reviews on this repo. Configure here. |
[Medium impact] The PR appears safe to merge; no actionable new issues were found. Summary
Reviews (3) · Last reviewed commit: "Merge branch 'main' into perf/issue-857-..." · Reviewed by Greptile |
There was a problem hiding this comment.
🟡 Changes recommended
The new Gerrit segment prefilter excludes previously selectable historical changesets from explicit-repository requests when the segment’s last Gerrit repository is disabled or deleted, changing KPI and time-series results.
1 open issue
What changed in this PR
Optimizes the Tinybird patchsets_per_review widget by restricting scans to Gerrit segments, reducing unnecessary reads for projects and collections.
Changes:
- Adds a segment lookup based on enabled Gerrit repositories.
- Centralizes changeset, repository, and date filters in a shared node.
- Routes KPI and time-series calculations through that node, leaving
pull_requests_filteredunchanged.
| File | Description |
|---|---|
services/libs/tinybird/pipes/patchsets_per_review.pipe |
Adds Gerrit segment pruning and shared changeset filtering for both aggregations. |
Review effort: Balanced
Signed-off-by: anilb <epipav@gmail.com>
|
@greptileai review |

Summary
patchsets_per_reviewhad a p95 of 2.3s over the last 7 days (18.8K calls). 87% of the calls come from collection pages, which show the widget on all 614 collections. Every call read all pull requests of the project or collection throughpull_requests_filteredand only then kept the Gerrit changesets. Only 10 projects have Gerrit changesets (1.4M of the 40M rows inpull_requests_analyzed), so a collection like CNCF read 27M rows to return zeros.Changes
patchsets_per_review_gerrit_segments: the segments with an enabled repository connected through a Gerrit integration.patchsets_per_review_changesets: readspull_requests_analyzedwith the filters ofpull_requests_filtered(segment,repos_to_channels), plus the Gerrit segments and the existing changeset conditions (platform = 'gerrit', patchsets present and above 0) and the date range.pull_requests_analyzedis sorted bysegmentId, so the Gerrit segment filter skips the pull requests of every other project.pull_requests_filteredis unchanged; other pipes still use it.Validation
Read-only queries on production data, current pipe against this one, for 11 parameter sets:
Same output on all 11: CNCF and LFN collections (KPI and monthly), ONAP monthly, OpenStack KPI (average) and yearly series without dates, OpenDaylight weekly average, k8s KPI without dates, and two
reposfilters (a GitHub mirror URL on fd.io, a Gerrit repository on ONAP).Rows read:
Gerrit projects keep about the same cost. What remains for the others is the shared lookups (
repos_to_channels, segments, repositories), about 0.4M to 1.2M rows.The 10 segments that hold Gerrit changesets today are all in
patchsets_per_review_gerrit_segments.tb fmt --difffrom tinybird-cli 5.22.2, the version CI installs, passes.Deploy
Push the pipe with
--force. It needs no new datasource and the insights app needs no change.Type of change
Related issue
Refs linuxfoundation/lfx-cdp-insights-ops#857