feat: classify stream-failed audits as errors and add picklist filters - #860
Merged
Conversation
- Record status code 0 (outside any HTTP band) when 2xx headers were sent but the stream later failed (first-byte timeout / stream interruption), so audit summaries, success filters and the dashboard no longer count these requests as successful. - Add an "other" status filter matching non-standard status codes; the startup migration backfills existing 2xx+error_code records to 0 and relaxes the status_code CHECK (idempotent on SQLite and PostgreSQL). - Upgrade the key/account filters on the request audit page to searchable, scrollable picklists (accounts limited to the first 50 matches), reusing the existing DataTableFilters group-search pattern.
Contributor
Author
Owner
补充优化根据代码审查进一步调整审计结果模型与大数据量筛选实现:
大账号池优化
界面优化
验证
|
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
Fixes a misclassification in request audit: when a request returned a 2xx response header but the stream later failed (e.g. Build response-header timeout / first-byte timeout /
upstream_stream_interrupted), the audit record keptstatus_code = 200. As a result these failed requests were counted as successful in audit summaries, the success filter, and the dashboard, and could not be filtered out.Backend
auditStatusForRecord: when 2xx headers were sent buterror_codeis non-empty, the stored status code becomes0(outside any HTTP band). Applied to both the responses path (service.go) and image/video (image.go).status_codeis 2xx anderror_codeis empty; everything else counts as failed.status=otherfilter (status_code < 100 OR status_code >= 600) so these records can be queried directly.ensureAuditStatusCodeConstraints: relaxes thechk_request_audits_status_codeCHECK to allow0, then backfills existing 2xx+error_code records to0. Order matters (constraint first, then backfill). The "allows zero" check is dialect-aware (SQLiteBETWEEN 0 AND 599vs PostgreSQL(status_code >= 0) AND (status_code <= 599)), idempotent on both.Frontend (request audits page)
statusCode === 0with an error code, show an amber "error" label instead of the misleading200; the tooltip keeps the concrete error code.DataTableFiltersgroup-search pattern:providerso accounts from any provider (grok_build/grok_web/grok_console) can be filtered.Verification
auditStatusForRecord, theotherfilter + summary semantics, the backfill migration idempotency, and the dialect-aware constraint check.tsc,eslint,vite buildall pass.0and become visible under the "other error" filter.Screenshot (local acceptance run)
Status column shows the amber error label and the filter picklists for keys/accounts.