Show upstream network latency and prefill breakdown in request details - #79
Closed
chokhung588-cell wants to merge 1 commit into
Closed
chokhung588-cell wants to merge 1 commit into
chokhung588-cell wants to merge 1 commit into
Conversation
…in request details
Author
|
Holding PR open until upstream CLIProxyAPI core PR (router-for-me/CLIProxyAPI#6087) is merged. |
Author
|
PR is ready and tested on live VPS (Debian 11 / CPA v7.3.15). Note: Fully backward-compatible with existing core; paired with router-for-me/CLIProxyAPI#6087. |
Author
|
Temporarily closed by author; will reopen once router-for-me/CLIProxyAPI#6087 is merged. |
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
DNS + TCP + TLSorConnection reused)Prefill = TTFT - Upstream TTFB)en,zh-CN,zh-TW,ru).—/不可用with zero schema migration required.Why
In proxy architectures, users frequently ask why the client-side Time To First Token (TTFT) is significantly higher than expected. Without upstream breakdown, operators cannot determine whether the delay is caused by:
By recording upstream timings exposed by CLIProxyAPI, the dashboard now enables instant diagnosis.
Changes
internal/plugin/usage.go:upstream_ttfb,conn_setup,first_packet, andconn_reusedfrom usage payload with dual format tolerance (nanoseconds integer or duration string).internal/plugin/request_log.go:RequestDetailstruct.Upstream TTFB (ns),Conn setup (ns),First packet (ns),Conn reused).internal/plugin/dashboard.go:s/ms).internal/plugin/preferences.go:columns_detailpreference configuration.internal/plugin/locales/{en,zh-CN,zh-TW,ru}.json:internal/plugin/upstream_latency_test.go):TestDecodeUsageUpstreamTiming: validates JSON parsing of integers and strings.TestDecodeUsageUpstreamTimingMissing: verifies graceful backward compatibility with missing fields.TestRequestDetailForUsagePropagatesUpstreamTiming: verifies struct propagation.TestRequestDetailJSONRoundTripKeepsUpstreamTiming: verifies BoltDB JSON serialization lossless round-trip.Validation
gofmt -w .— clean.go vet ./...— clean (no warnings).go test -v ./... -count=1— all passed (100% test suite pass)..soon live Linux VPS (Debian 11 / CPA v7.3.15), verified real streaming requests (gemini-3.8-flash-high) and tooltip accuracy.