Skip to content

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

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

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

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #37963 to 2.0.

  • 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.
  • Resolved one conflict: the new generation parameter uses Optional[int] to match 2.0's typing style.
  • test_operation_metrics.py passes (45 tests).

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

This PR keeps delayed metrics from an earlier run out of the next run’s totals.

  • Ingestion metrics drop worker-held operations when a new run starts.

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

Diagram

sequenceDiagram
    participant Q as Metrics queue
    participant W as Metrics worker
    participant R as Run reset
    participant S as Metrics state
    Q->>W: Take item tagged generation N
    R->>S: Under lock, advance generation and clear totals
    W->>S: Record item tagged generation N
    S-->>W: Drop stale item under lock
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 ulixius9 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 tagging changes queued-metric handling across run resets; delayed prior-run operations may be dropped, affecting per-run metric totals.

Backport of the metrics worker fix so a new run no longer records an item the worker already held into the prior run. 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 306d4f3 into 2.0 Nov 18, 2026
66 of 69 checks passed
@Khairajani
Khairajani deleted the backport-37963-2.0 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