accounting: use the accountant's own size bound (Withhold(res)), stop passing TokensBefore
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Read core/accounting/host.go around line 654 and core/accounting/metrics.go around line 252, then check the accountant dependency versions and the v0.11.0 API. Update the dependency and make both call-site changes described in the issue; run the accounting tests. Done when Withhold receives only the result and the observation no longer sets TokensBefore.
由索引模型根据 Issue 内容生成。
描述
Summary
Cortex passes its own request size to the accountant in two places. accountant v0.11.0 measures the size itself, and the host size is going away (rossoctl/context-guru#1523). Please move Cortex to the library's own size bound.
What we found
Cortex main at 2cb6e041 (accountant pinned at v0.10.0):
core/accounting/host.go:654:accountant.Withhold(p.result, before). This is the legacy form with a host size.core/accounting/metrics.go:252:acmetrics.Observation{..., TokensBefore: tokensBefore}. A positiveTokensBeforemakes the sink use the legacy host bound.
Why
- With a host size, the bound compares host tokens against the accountant's ratio tokens. That is two different measures. Removed text that is denser than the request average (hex, code) can then make an honest request fail as
implausible_size(rossoctl/accountant#126 review). - From v0.11.0,
Withhold(res)with no size measures the client messages itself (Result.MessageTokens,PricedOp.SavedMessages/CausedMessages, design §6.7). Tool declarations are not counted. - context-guru moved to it in rossoctl/context-guru#1529.
Proposal
- Bump to accountant and accountant/metrics v0.11.0.
core/accounting/host.go: callaccountant.Withhold(p.result).core/accounting/metrics.go: stop settingTokensBeforein theObservation.- This is a behavior change for Cortex: the size bound moves from the host measure to the library measure. The Cortex owners decide it.
After this merges, the accountant removes the size argument of Withhold, SizeNotGiven and Observation.TokensBefore in its next minor release (rossoctl/context-guru#1523, #1524).
- 主要语言
- Go
- 星标
- 31
- 派生
- 49
- 平均合并
- 9 小时 43 分钟
- 30 天内合并 PR
- 367
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rossoctl/cortex 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
bug laptop
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
相似的 Issue
-
taskmanager: a failed v1alpha1 backup leaves the partial backup behind可能已有人在做 @arshil42 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 80/100
ether/etherpad-go#571 ·
维护者通常 1 天内回复
-
labeler: read a limit above math.MaxInt as math.MaxInt in nonNegative (CodeQL alerts #20 and #21)未关闭cost:approved factory:queued factory:tracking priority:p2 rank:12 ready-for-doing task:approved tokens:50k
难度 2/5 1-3 小时 新手友好度 88/100
sisaku-security/sisakulint#860 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100