← Back to Pull requests

feat: Configurable per-threshold weighted laning #19665

Closed
unknown closed this pull request without merging on Jul 15, 2026 21:32 UTC
View on GitHub
unknown unknown commented on Jul 08, 2026 06:30 UTC
Author

Description

Follow-up to the weighted query laning strategy (#19225).

Configurable per-threshold weights (WeightedQueryLaningStrategy)

Previously every breached threshold added exactly 1 to a query's cost. This adds optional per-threshold weights so a breach on one dimension can count for more than another (e.g. a huge segment scan should outweigh a slightly-old interval). Each weight defaults to 1, so existing configs are unchanged.

New optional properties (each an integer >= 1, default 1): periodWeight, durationWeight, segmentCountWeight, segmentRangeWeight.

a weight must be >= 1 and its corresponding threshold must be configured

Example. A segment-count breach counts double, so a query breaching only segmentCount still reaches a cost-2 lane:

{
  "strategy": "weighted",
  "segmentCountThreshold": 1000,
  "durationThreshold": "P1D",
  "segmentCountWeight": 2,
  "lanes": {
    "low":      { "minCost": 1, "maxPercent": 30 },
    "very-low": { "minCost": 2, "maxPercent": 10 }
  }
}

id dimension on the query/priority metric (QueryScheduler)

Also adds the query id dimension for easily finding a query's priority.

Key changed classes


  • WeightedQueryLaningStrategy — optional per-threshold weight fields + validation

  • QueryScheduler — id dimension on the query/priority metric
  • Release note


    The weighted query laning strategy now supports optional per-threshold cost weights (periodWeight, durationWeight, segmentCountWeight, segmentRangeWeight; default 1), and the query/priority metric now includes a id dimension.

    This PR has:

  • been self-reviewed.

  • using the concurrency checklist (Remove this item if the PR doesn't have any relation to concurrency.)

  • added documentation for new or modified features or behaviors.

  • a release note entry in the PR description.

  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.

  • added or updated version, license, or notice information in licenses.yaml

  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.

  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.

  • added integration tests.

  • been tested in a test Druid cluster.
  • Diff: 332 lines (+249 / -83) across 4 files Reviewer: maytasm Review duration: 10981m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.65) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.65 · 332 lines diff across 4 files
    0.65
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.347
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.065
    Real PR Conversation Timeline
    1 comments
    "Review active on #19665"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 65.3% (HIGH) · Higher = larger blast radius
    65.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.8% · Safe to merge
    25.8%
    Repository