Skip to content

[2.1] Fixes #37961: Wait for the metrics worker before resetting for a new run - #38129

Merged
Khairajani merged 1 commit into
2.1from
backport-37963-2.1
Nov 18, 2026
Merged

Khairajani merged 1 commit into
2.1from
backport-37963-2.1

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #37963 to 2.1.

  • When a new run starts, an item the metrics worker already held was recorded after the reset, into the new run.
  • Queued items now carry a run generation; a reset bumps it under _lock and a stale item is dropped.
  • test_operation_metrics.py passes (45 tests).

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

This backport keeps queued metrics from an earlier run out of a new run.

  • New ingestion runs keep old worker-held metrics out of their summaries.

No actionable issues found. Tests were not run during this review.

Diagram

sequenceDiagram
    participant P as Recording thread
    participant Q as Metrics queue
    participant W as Metrics worker
    participant R as New run
    P->>Q: Queue item with generation N
    Q->>W: Take item
    R->>R: Under lock, advance generation and clear metrics
    W->>W: Under lock, compare generations
    W->>W: Drop stale item
Loading

Reviews (1) · Last reviewed commit: "Fixes #37961: Wait for the metrics worke..." · Reviewed by Greptile

…run (#37963)

* fix(ingestion): wait for the metrics worker before resetting for a new run

An item the worker held when a new run started was recorded after the reset,
into the new run. set_run_context now waits for it, under the same 1s bound
as summary reads, before resetting.

* fix(ingestion): drop a stale metrics item by run generation instead of waiting

The bounded wait still leaked an item the worker recorded after it expired.
Queued items now carry the run generation; a reset bumps it under the lock and
_record_sync drops a stale item. A new run no longer waits.

(cherry picked from commit 96ebbcd)
@Khairajani
Khairajani requested a review from a team as a code owner November 18, 2026 14:11
@Khairajani
Khairajani requested review from mohittilala and removed request for a team November 18, 2026 14:11
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Generation checks make metrics resets drop stale worker items, preventing cross-run metric contamination; the change is limited to operation metrics.

Fixes a race where a metrics worker item already held at the start of a new run was recorded into that run after the reset. Queued items now carry a run generation, and a reset bumps it under _lock so stale items are dropped. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@Khairajani
Khairajani merged commit 0974f93 into 2.1 Nov 18, 2026
46 of 48 checks passed
@Khairajani
Khairajani deleted the backport-37963-2.1 branch November 18, 2026 16:23
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.

1 participant