Skip to content

perf: run the issue analysis copy every 3 hours - #5536

Merged
themarolt merged 1 commit into
mainfrom
perf/issue-1182-issue-analysis-copy
Dec 6, 2026
Merged

themarolt merged 1 commit into
mainfrom
perf/issue-1182-issue-analysis-copy

Conversation

@themarolt

Copy link
Copy Markdown
Contributor

Summary

issue_analysis_copy_pipe runs every hour. Production still runs a pre-#5028 version (reverted on 2026-11-02 because the #5028 version took ~78 min): it reads activityRelations_deduplicated_cleaned_bucket_union three times per run (median 31 min, 3.3B rows / 303 GiB) and leaves out bot-opened and bot-closed issues. Main's version (#5165: one read of the unfiltered buckets plus the snapshot MV delta) has never been pushed and is expected at ~40 min per run. This runs it every 3 hours so main's version can go out with about a third of today's daily copy load.

Changes

  • COPY_SCHEDULE 0 */3 * * * (was 20 * * * *). On the hour, the 00:00 run ends before the 00:40-00:48 bucket merges and before health_score_copy (00:50), so every daily reader of issues_analyzed (00:50-02:15) gets the 00:00 run; copies starting at :00 waited a median 2 s for a worker over the last 2 days, against 32 s at :20.
  • platform is wrapped in toLowCardinality(...): tupleElement drops LowCardinality and the issues_analyzed column is LowCardinality(String).
  • The description says why it runs every 3 hours and who reads the table at query time.

Readers: the Insights issues-resolution widget and public API endpoint (issues_count, issues_average_resolve_velocity) read issues_analyzed at query time and see data up to ~3 h old; the health score, leaderboard and agentic AI copies are daily.

Checked read-only on production: every input main's version reads exists with the referenced columns; the whole pipe run for one segment finished in 8 s with 5,319 rows (the current table has 4,994 for that segment; the difference is bot-opened issues), and its output columns match issues_analyzed in order, names and nullability.

Deploy

Tinybird is not deployed on merge: tb push services/libs/tinybird/pipes/issue_analysis_copy_pipe.pipe --force from an up-to-date checkout, outside a running copy (avoid the hour mark). This ships main's whole version for the first time; the first run rebuilds issues_analyzed (replace) and adds bot-opened and bot-closed issues. Then check the runtime of the first runs in tinybird.datasources_ops_log.

Type of change

  • Performance improvement

Related issue

Refs linuxfoundation/lfx-cdp-insights-ops#1182

Each run reads the unfiltered activity buckets (~40 min), and only the
issues-resolution widget and API endpoint read issues_analyzed at query time.
On the hour, the 00:00 run ends before the bucket merges and the daily readers.

Refs linuxfoundation/lfx-cdp-insights-ops#1182

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI balanced review requested due to automatic review settings December 6, 2026 20:43
@themarolt
themarolt requested review from a team and lfx-one as code owners December 6, 2026 20:43
@cursor

cursor Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Scheduling and a type-cast fix in an analytics copy pipe; query-time issue metrics may be up to ~3 hours stale instead of ~1 hour.

Overview
Slows the issue_analysis_copy_pipe refresh from hourly (:20) to every 3 hours on the hour (0 */3 * * *), cutting daily copy load while keeping the ~00:00 run ahead of bucket merges and downstream daily readers of issues_analyzed.

In the issues node, platform is emitted with toLowCardinality(...) so it matches the issues_analyzed target schema after tupleElement strips LowCardinality.

Pipe DESCRIPTION text is updated to document the schedule rationale, run duration, and that only the issues-resolution widget/API read this table at query time (~3h staleness).

Reviewed by Cursor Bugbot for commit 0a207da. Bugbot is set up for automated code reviews on this repo. Configure here.

@lfx-one

lfx-one commented Dec 6, 2026 •

Copy link
Copy Markdown

@themarolt I'm starting review 1 of this pull request now (started 2026-12-06 20:44 UTC using review agent v0.1.37). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by re-review, to start another. For help with the review agent, see https://github.com/linuxfoundation/lfx-review-agent/issues.


Hi Uros Marolt, thanks for the detailed PR description and the production checks behind it.

Summary

This change moves issue_analysis_copy_pipe from hourly to every 3 hours, on the hour. It also wraps platform in toLowCardinality(...) so it matches the issues_analyzed column type, and it updates the pipe description to explain the new cadence. The change is small and consistent with the PR's stated reasoning, and I found no concerns.

Decision

✅ Approved

The required DCO check passed on 0a207da.

Details

Overall impression: This is a one-file Tinybird pipe change: a schedule change, a type cast, and description text. The toLowCardinality cast matches the target column type, as the PR describes. The description text matches the new COPY_SCHEDULE. I couldn't verify the production runtime and timing claims (about 40 minutes per run, the 00:40 bucket merges, the 00:50 daily readers) from the repository, so I took them from the PR description. The PR notes that Tinybird is not deployed on merge and gives the tb push steps, which is worth following after merge.

Other reviewers and CI checks: Cursor Bugbot posted a summary comment with no findings, and it agrees with this review. The only required check, DCO, passed.

Documentation reminder: changed COPY_SCHEDULE. Please check product pages and external docs; the author and maintainers own those updates.

Rule files: read AGENTS.md, .claude/rules/commit-workflow.md, .claude/rules/skill-guidance.md, .claude/rules/adr-format.md, CONTRIBUTING.md; skipped none

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

Copilot AI 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.

🔵 Needs a closer look

The previously undeployed full-workspace copy has only single-segment timing data, so full-scale runtime and worker contention need human validation to confirm it finishes before nightly consumers run.

No open issues 🎉

What changed in this PR

Reduces Tinybird issue-analysis copy frequency to lower daily processing load while supporting CDP’s issue metrics.

Changes:

  • Runs the copy every three hours, on the hour, instead of hourly at :20.
  • Preserves the destination’s LowCardinality(String) type for platform.
  • Documents scheduling rationale and query-time consumers.
File Description
services/​libs/​tinybird/​pipes/​issue_analysis_copy_pipe.pipe Updates the copy schedule, platform type conversion, and freshness documentation.

Review effort: Balanced

@lfx-one lfx-one left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No blocking or minor findings. The schedule change and the toLowCardinality cast are consistent with the pipe's target schema, and the pipe description now explains the new cadence.

Documentation

This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:

  • COPY_SCHEDULE (changed from 20 * * * * to 0 */3 * * *, so query-time issue metrics can be up to about 3 hours old)

@greptile-apps

greptile-apps Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge.

Summary

Runs issue_analysis_copy_pipe every three hours instead of hourly.

  • The issue-analysis table is rebuilt every three hours on the hour.
  • Issue records store platform values in the table’s compact form.

Intentional trade-off: themarolt acknowledges that the issues-resolution widget and API endpoint will receive less frequent updates.

Reviews (1) · Last reviewed commit: "perf: run the issue analysis copy every ..." · Reviewed by Greptile

@themarolt
themarolt merged commit e0c0449 into main Dec 6, 2026
17 checks passed
@themarolt
themarolt deleted the perf/issue-1182-issue-analysis-copy branch December 6, 2026 20:49
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