Skip to content

Add a Merge Queue Timings query - #867

Open
uzairchhapra wants to merge 1 commit into
grafana:mainfrom
uzairchhapra:feat/merge-queue-timings
Open

uzairchhapra wants to merge 1 commit into
grafana:mainfrom
uzairchhapra:feat/merge-queue-timings

Conversation

@uzairchhapra

@uzairchhapra uzairchhapra commented Nov 18, 2026 •

Copy link
Copy Markdown

Type of Change

  • 🚀 Feature

Feature

What is this feature?

Adds Merge Queue Timings to the GitHub data source. It pairs GitHub pull request timeline enqueue and removal events and returns one row per attempt with timestamps, exit reason, and duration_seconds. A retry is a separate row, and an attempt without a matching removal has no finalized duration. Both PR search and timeline continuation are paginated.

Why is this feature needed?

Workflow Runs and Check Runs measure CI execution, not how long a pull request spent in the merge queue. Queue attempts let teams build duration distributions or compare successful merges and other exits without mixing those timings.

Who is this feature for?

Teams using GitHub's native merge queue who want to visualize queue latency in Grafana.

How to test this feature

  1. In Grafana Explore, select the GitHub data source and Merge Queue Timings, with owner github and repository docs.
  2. Set the UTC time range to November 17, 2026, 08:50:00 through 08:52:00. Find PR #46973: enqueue at 08:45:01Z, exit at 08:50:56Z, reason merged, duration 355 seconds.
  3. For a dashboard, feed duration_seconds to a Histogram panel; optionally filter to exit_reason = merged.

Closes #866.

Please check that:

  • Tests for this change have been added/updated.
  • Documentation has been added/updated (where applicable).

Verification

  • go test ./...
  • Frontend Jest suite (35 tests), typecheck, lint, spellcheck, and production build
  • Ran the new backend query handler against the live GitHub API and verified the 355-second result above. The steps in Grafana Explore are a reviewer test plan, not a claim of UI end-to-end testing.

Special notes for your reviewer

The dashboard range selects PRs by updated_at; the query then returns their full queue history. This is not an event-time filter, and the docs call out that later PR updates can change a historical selection. The first page of timeline events is fetched with PR search to avoid a separate request per PR for the common case. This change does not aggregate individual PR or merge-group checks.

Local Grafana smoke test: Verified through local Grafana 13.1.9 using /api/ds/query against live GitHub data. github/docs#46973 returned a merged attempt of 355 seconds with the expected timestamps and seconds unit. A range with no matching PR returned zero rows with the same frame schema. This exercised the installed plugin through Grafana, not the browser UI.

Reconstruct queue attempts from pull request timeline events and expose durations for Grafana dashboards.

Refs grafana#866
@uzairchhapra
uzairchhapra requested a review from a team as a code owner November 18, 2026 03:33
@cla-assistant

cla-assistant Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

[Feature Request] Add a Merge Queue Timings query

1 participant