fix(latency-reporter): skip TTFT and TPOT on inverted timestamps #4029
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.41) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.41 · 198 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.317
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #4029"
general
weight: 0.35
ahg-g
What type of PR is this?
/kind bug
What this PR does / why we need it:
latency-reporterchecks!IsZero()onReceivedTimestamp,FirstTokenTimestamp, andCompleteTimestampbefore observingllm_d_epp_latency_ttft_secondsandllm_d_epp_latency_tpot_seconds. Without a timestamp ordering check, inverted or equal timestamps produce a negative or zero duration in the histograms, whereasRecordRequestTTFTandRecordRequestTPOTinpkg/epp/metrics/metrics.gorequire strictly positive elapsed time via.After(...)and compute per-token duration in floating-point seconds.Require
response.FirstTokenTimestamp.After(response.ReceivedTimestamp)before recording TTFT, and require bothresponse.FirstTokenTimestamp.After(response.ReceivedTimestamp)andresponse.CompleteTimestamp.After(response.FirstTokenTimestamp)inmeanTPOT, returning the mean gap infloat64seconds.The review playbook (
docs/review/) caught this bug on PR #3715.Which issue(s) this PR fixes:
N/A
Release note _(write
NONEif no user-facing change)_:``
release-note
`latency-reporter skips TTFT and TPOT histogram observations when response timestamps are inverted or equal.
Test plan:
.