Skip to content

Evaluate metric-alert groups with a concurrency pool#8213

Open
jonathanawesome wants to merge 1 commit into
mainfrom
metric-alert-evaluation-concurrency-queue
Open

Evaluate metric-alert groups with a concurrency pool#8213
jonathanawesome wants to merge 1 commit into
mainfrom
metric-alert-evaluation-concurrency-queue

Conversation

@jonathanawesome

Copy link
Copy Markdown
Member

This PR replaces the fixed-batch barrier in the evaluateMetricAlertRules cron with a p-limit concurrency pool, so metric-alert groups are evaluated with continuous bounded parallelism instead of synchronized batches of 5.

Before, a batch couldn't start until the previous one fully drained, so one slow group (like a timed-out ClickHouse query) idled the other slots and delayed every later group, including cheap ones from other orgs; the pool keeps up to 5 groups in flight at all times, starting the next as soon as one finishes.

Behavior is otherwise unchanged: same cap (still below the Postgres pool size), same allSettled failure isolation, and the same batched last_evaluated_at update once all groups drain. p-limit is the limiter already used by the usage and migrations packages.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request refactors the metric alert rules evaluation task to use a fixed-capacity concurrency pool via the p-limit library, replacing the previous batch-based chunking approach. This allows groups to be processed continuously without waiting for an entire batch to complete, improving throughput when some groups are slower than others. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
hive 11.5.0-alpha-20260713141004-94c8a3e737f4c900a64ddecd96c330c15fc2f4c6 npm ↗︎ unpkg ↗︎

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/arm64

Image Tags: 11.5.0-alpha-94c8a3e, 94c8a3e, 94c8a3e737f4c900a64ddecd96c330c15fc2f4c6

@jdolle jdolle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please add a changeset is all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants