feat(analytics): add route reliability and latency analytics - #1005
Draft
Wibias wants to merge 4 commits into
Draft
feat(analytics): add route reliability and latency analytics#1005Wibias wants to merge 4 commits into
Wibias wants to merge 4 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This was referenced Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RI-03 of the Router Intelligence / Routing Control Plane programme. Adds
source-backed routing analytics computed from the request-history index
(RI-02), never from repeated full JSONL scans.
Read-only: this PR cannot change routing behavior (ADR-10 - no automatic
self-tuning).
Metrics
GET /api/routing-analytics(filters:provider,model,profileId,surface,from,to) returns:provider failures)
percentiles, with TTFT sample count + coverage)
terminalStatus: "incomplete")rate-limit-429/key-429/oauth-401/anthropic-oauth-429recovery kinds)
(reuses
usage/cost.tspricing; unknown prices stay unknown, never zero)high>= 100,medium>= 20, elselow)historyTruncatedflag when the analysis cap (50,000 rows) is hitScope
src/routing/analytics.ts-computeRoutingAnalytics()over the SQLiteindex (bounded, deterministic, single SQL pass + JS aggregation).
src/server/management/routing-analytics-routes.ts- the endpoint,registered in
management-api.ts.tests/routing-analytics.test.ts- 8 tests.Privacy / security
privacy-bounded columns the index already stores.
the process.
bun run privacy:scanpasses.Compatibility
/api/logs,/api/request-history, andusage.jsonlcontracts unchanged.
Dependency
feat/ri-02-request-history-indexhead7efb6e842. PR target isdev;the diff includes earlier PR commits until they merge.
Non-goals
profileIdfilter/breakdown onlyreads RI-01 traces.
Local verification (exact)
bun x tsc --noEmit-> PASSED (0 errors)bun run test tests/routing-analytics.test.ts-> 8/8 passtrace, request-log, usage-log, combos) -> 144/144 pass
bun run privacy:scan-> passedNotes for reviewers
classifyRow(): status 499 /client_cancel-> cancelled;terminalStatus: "incomplete"-> failure;status >= 400 -> failure; otherwise success.
nullestimates andpriceCoverage: 0- never afake zero cost.