Skip to content

3.x.x: Record the metrics collector's own cancelled pool acquisitions #337

Closed

Description

@kiwidream

Follow-up from #328 (PR #334), raised by the independent metrics review.

Problem

Two producers now record into qbit_prism_database_pool_acquire_seconds, and they treat cancellation differently:

  • the ledger (3.x.x: Record advisory-lock and pool-acquire wait metrics in the ledger #328) records a wait abandoned by cancellation as result="failure" with the time actually spent waiting, through a drop guard, so the longest waits cannot vanish from the histogram;
  • the collector (src/metrics/collectors.rs) sits inside a 3 second tokio::time::timeout and records only on completion, so an acquisition cancelled at 3 seconds records nothing.

The collector's behaviour is documented and defensible: its cancellation is represented by collector availability rather than a fabricated duration. But inside one series, the same event now means different things depending on which producer saw it.

Proposed change

Give the collector the same drop guard the ledger uses, so a cancelled acquisition records failure with its elapsed wait, and update the inventory text that currently describes the collector as recording only completed attempts.

This is a src/metrics/ change, owned by workstream B, which is why #328 did not make it.

Refs #328, #334.

Activity

  1. self-assigned this
    on Sep 14, 2026
  2. djh58 commented on Sep 14, 2026

    @djh58
    Member

    Completed via #345, merged into 3.x.x as b8b72f8. Cancelled collector pool acquisitions record exactly once with elapsed wait; error/deadline and availability contracts remain unchanged. Independent reviews, required disposable PostgreSQL regression and all15 CI checks passed on final reviewed head1a87dd2. Optional shared-timer consolidation is explicitly deferred; alert suppression behavior remains separately tracked in #336.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions