Skip to content

Expose Per-Namespace Pending Task Metrics for Queue Move Groups - #12474

Open
exodus2512 wants to merge 2 commits into
temporalio:mainfrom
exodus2512:expose-pending-tasks-metric
Open

exodus2512 wants to merge 2 commits into
temporalio:mainfrom
exodus2512:expose-pending-tasks-metric

Conversation

@exodus2512

Copy link
Copy Markdown

What changed

Adds a queue_pending_tasks_per_namespace metric to make
per-namespace pending task counts observable for queue move groups.

The metric is recorded from the existing pending-task calculation in
actionMoveGroup, avoiding any additional task-count computation.

The metric includes:

  • namespace
  • task_category

Zero pending-task counts are not emitted.

Why

The move-group mechanism uses a pending-task threshold to move noisy
task groups to dedicated readers. Previously, operators could observe
the threshold being exceeded through logs, but could not monitor the
per-namespace pending task count leading up to that threshold.

This metric makes that state observable.

Implementation

  • Added QueuePendingTasksPerNamespace dimensionless histogram.
  • Recorded the existing pendingTaskPerGroup values.
  • Added namespace name resolution with a safe namespace-ID fallback.
  • Added support for standard and outbound grouper keys.
  • Added focused unit tests for metric emission, tags, zero counts,
    namespace resolution fallback, and outbound grouper keys.

Tests

  • go test ./service/history/queues
  • go test ./common/metrics
  • Focused move-group and checkpoint tests
  • git diff --check
  • gofmt

All tests pass.

Fixes #12450

Copilot AI balanced review requested due to automatic review settings October 8, 2026 17:24
@exodus2512
exodus2512 requested review from a team as code owners October 8, 2026 17:24
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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.

No metric exposes per-namespace pending task count, so the move-group threshold is unobservable

3 participants