predictedlatency: accept contextTTL as a duration string #4170
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 247 lines diff across 3 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.330
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4170"
general
weight: 0.35
ahg-g
What type of PR is this?
/kind bug
What this PR does / why we need it:
contextTTLin thepredicted-latency-producerconfiguration was a plaintime.Duration, so JSON accepted it only as an integer number of nanoseconds. The README's5mfailed to decode, and300became a 300 ns TTL. Details are in the issue.This PR gives the field a small
Durationtype whoseUnmarshalJSONaccepts a duration string such as5m(throughtime.ParseDuration) or, as before, an integer number of nanoseconds.nullkeeps the default, as it did before. Every value that loads on main loads to the same TTL with this change, including0and negative values, which ttlcache treats as no expiry. The default stays 5 minutes, and the README row says the value is a duration string.I did not use
metav1.Duration, which the utilization saturation detector uses, because it rejects integers and would break configurations that set the TTL in nanoseconds today.Tests in
plugin_test.go, all throughPredictedLatencyFactory:"90s"gives 90 seconds,300000000000gives 5 minutes, and an omitted ornullcontextTTLkeeps the 5 minute default."30s"loads, and"5 minutes"is rejected.go vetis clean on the package.A small integer such as
300still loads as 300 ns. I left a range check or warning out because0and negative values mean no expiry today, and I did not want to change what loads. I can add one if you prefer.Which issue(s) this PR fixes:
Fixes #4169
Release note _(write
NONEif no user-facing change)_:``
release-notecontextTTLThe predicted-latency-producer plugin now accepts
as a duration string such as5m, as its README documents. Integer values are still read as nanoseconds.
``