Skip to content

fix(metrics): count client-disconnect cancellations as success="cancelled" - #6212

Merged
nicoloboschi merged 2 commits into
mainfrom
fix/metrics-count-cancelled
Oct 30, 2026
Merged

nicoloboschi merged 2 commits into
mainfrom
fix/metrics-count-cancelled

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Closes #6126.

What changes

A recall or reflect cancelled because the client disconnected used to be dropped from the operation metrics (#2185, #5955). That stopped it inflating the failure rate, but it also made it invisible: no way to see how often clients give up, or after how long.

Now it is recorded like any other operation, with success="cancelled":

  • hindsight_operation_operations_total{success="cancelled"} counts client hang-ups.
  • hindsight_operation_duration{success="cancelled"} shows how long the request ran before the client cut it — makes too-short client timeouts visible from metrics.
  • success="false" still means a server-side failure only, so failure-rate alerts are unaffected.
  • Totals that don't filter on success now include cancellations.

An unrelated 499 (no OperationCancelledError in its cause chain) is still a failure.

Tests

tests/test_metrics.py: the two exclusion tests now assert both cancel paths (bare OperationCancelledError and HTTPException(499) from it) record success="cancelled" on the counter and the histogram.

…lled" (#6126)

A recall/reflect the client abandoned was dropped from
hindsight.operation.total and .duration entirely (#2185), so there was no
way to see how often clients gave up or how long they waited first. It is
now recorded with success="cancelled": counted like any other operation,
with its time-until-cancel in the duration histogram, while
success="false" stays a server-failure-only signal.
@nicoloboschi
nicoloboschi merged commit d843830 into main Oct 30, 2026
101 of 110 checks passed
@nicoloboschi
nicoloboschi deleted the fix/metrics-count-cancelled branch October 30, 2026 13:11
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.

Observability: client-disconnect cancellations are counted as failed operations (success=false), inflating failure-rate metrics

1 participant