Skip to content

Count each request once and backend 5xx as failures - #267

Merged
thushan merged 5 commits into
mainfrom
fix/stats-counting
Nov 1, 2026
Merged

thushan merged 5 commits into
mainfrom
fix/stats-counting

Conversation

@thushan

@thushan thushan commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Summary

Stats counted a request that named a model twice (since v0.0.29), and counted a backend 5xx as a success. For example, 10 requests with 4 backend 503s showed 20 total / 0 failures / 100%; they now show 10 / 4 / 60%. A backend 4xx, 429 included, still counts as a success.

Behaviour change: failure counts rise, so failure-count alerts start firing. Affected surfaces: /internal/status, /internal/metrics, /internal/stats/models, /internal/stats/translators and the dashboard. The client response, failover and circuit breaker behaviour are unchanged.

What changed

  • internal/adapter/proxy/core/base.go: single place that records the outcome, with 5xx treated as failed.
  • internal/adapter/stats/collector.go: request and endpoint counters no longer double count; model and translator stats follow the same rule.
  • internal/adapter/proxy/olla/service_retry.go and internal/adapter/proxy/sherpa/service_retry.go: both engines record per backend attempt.
  • internal/app/handlers/handler_translation.go: translator stats (passthrough and translation) count a 5xx as a failure.
  • Dashboard response-rate hover text no longer says "regardless of HTTP status".
  • Docs: release-notes entry and the v0.0.30 behaviour-change list.

Type of change

  • Bug fix
  • New feature
  • Backend / integration support
  • Documentation
  • Refactor / internal (no behaviour change)

How was this tested?

  • make ready and make ci-web passed on a trial merge of this branch with main (aa990f7).
  • Tests added for both engines, the collector, and the translation handler.

Checklist

  • make ready passes (test-short + test-race + fmt + vet + lint + align)
  • Tests added or updated for the change
  • Documentation updated (./docs) if behaviour or config changed
  • No new dependencies added

@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between aa990f7 and d34bfac.

Files selected for processing: 16
  • docs/content/about/release-notes.md
  • docs/content/api-reference/system.md
  • internal/adapter/proxy/core/base.go
  • internal/adapter/proxy/core/errors.go
  • internal/adapter/proxy/olla/service_retry.go
  • internal/adapter/proxy/proxy_model_stats_test.go
  • internal/adapter/proxy/sherpa/service_retry.go
  • internal/adapter/stats/collector.go
  • internal/app/handlers/handler_proxy.go
  • internal/app/handlers/handler_proxy_completed_status_test.go
  • internal/app/handlers/handler_translation.go
  • internal/core/ports/stats.go
  • web/dashboard/src/layout/StatusStrip.svelte
  • web/dashboard/src/panels/EndpointsPanel.svelte
  • web/dashboard/src/panels/OverviewPanel.svelte
  • web/dashboard/src/panels/OverviewPanel.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@thushan
thushan merged commit cf88d71 into main Nov 1, 2026
8 checks passed
@thushan
thushan deleted the fix/stats-counting branch November 1, 2026 00:12
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