Skip to content

feat(tide): shard large queries to avoid GitHub resource limits - #821

Draft
Prucek wants to merge 4 commits into
kubernetes-sigs:mainfrom
Prucek:tide-shard-large-queries
Draft

feat(tide): shard large queries to avoid GitHub resource limits#821
Prucek wants to merge 4 commits into
kubernetes-sigs:mainfrom
Prucek:tide-shard-large-queries

Conversation

@Prucek

@Prucek Prucek commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Shard Tide status and sync controller queries that exceed GitHub's query resource limits by splitting large or-queries into smaller batches
  • Add ShardQuery and ShardQueries functions to config.TideQuery that partition queries based on orgs and repos fields
  • Add comprehensive tests for query sharding logic and status controller integration

🤖 Generated with the help of AI assistance

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for k8s-prow ready!

Name Link
🔨 Latest commit 2151f08
🔍 Latest deploy log https://app.netlify.com/projects/k8s-prow/deploys/6a75a979d936ea0008507f64
😎 Deploy Preview https://deploy-preview-821--k8s-prow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 4, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Prucek
Once this PR has been reviewed and has the lgtm label, please assign cjwagner for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested review from cjwagner and matthyx August 4, 2026 11:03
@kubernetes-prow kubernetes-prow Bot added the area/tide Issues or PRs related to prow's tide component label Aug 4, 2026
…limits

The openshift org has 521 repos, producing a ~20KB search query that
consistently triggers GitHub's "Resource limits for this query exceeded"
error, returning 0 results. This means PRs in that org never receive
Tide status updates via the search path.

Split queries with more than 100 repo: terms into multiple shards
(e.g. "openshift#0", "openshift#1", ...), each containing up to 100
repos. The non-repo prefix (is:pr state:open sort:updated-asc etc) is
preserved in each shard. Shards run concurrently alongside other org
queries. The per-org latestPR checkpoint is advanced to the minimum
across all shards to ensure no PRs are skipped.

Only the status controller is affected; the sync controller uses
different query construction (orgRepoQueryStrings) which is unchanged.
@Prucek
Prucek force-pushed the tide-shard-large-queries branch from 1b60edf to 44a66b4 Compare August 5, 2026 09:45
@kubernetes-prow kubernetes-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 5, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

@Prucek: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-prow-verify-lint 44a66b4 link true /test pull-prow-verify-lint
pull-prow-integration 44a66b4 link true /test pull-prow-integration

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@Prucek
Prucek marked this pull request as draft August 5, 2026 12:48
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 5, 2026
Prucek added 3 commits August 7, 2026 11:25
Tide runs one GitHub GraphQL search per configured TideQuery per org
shard. At scale (~480 shards) the unbounded goroutine fan-out overwhelms
ghproxy, causing widespread client timeouts.

Add a new config field max_query_concurrency (default 0 = unlimited) that
limits concurrent search queries via errgroup.SetLimit in both the sync
and status controllers. Also promote the "failed to query" log from
Debug to Error so query outages are visible at default log level.
Add six new Prometheus metrics to give operators visibility into Tide's
GitHub query layer:

- tide_query_duration_seconds (histogram, controller × result)
- tide_query_prs_returned (histogram, controller)
- tide_query_errors_total (counter, controller × query_id × org_shard × error_class)
- tide_query_partial_results_total (counter, controller × query_id × org_shard)
- tide_sync_query_shards (gauge, controller × result)
- tide_pool_completeness_ratio (gauge, controller)

Also add classifyQueryError to break errors into actionable classes
(context_deadline, client_timeout, resource_limits, server_error, etc.)
instead of a binary success/error signal.
Temporary default until the config field is set in production.
This commit should be dropped before merging upstream.
@Prucek
Prucek force-pushed the tide-shard-large-queries branch from 44a66b4 to 2151f08 Compare August 7, 2026 09:46
@kubernetes-prow kubernetes-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tide Issues or PRs related to prow's tide component cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants